OSDN Git Service

Fix memory leak on error path when directory read fails.
authorrelan <relan@users.noreply.github.com>
Sat, 12 Nov 2016 06:48:06 +0000 (09:48 +0300)
committerrelan <relan@users.noreply.github.com>
Sat, 12 Nov 2016 06:49:33 +0000 (09:49 +0300)
libexfat/node.c

index fa04e25..3f49fb2 100644 (file)
@@ -109,6 +109,7 @@ static int opendir(struct exfat* ef, const struct exfat_node* dir,
        if (exfat_pread(ef->dev, it->chunk, CLUSTER_SIZE(*ef->sb),
                        exfat_c2o(ef, it->cluster)) < 0)
        {
+               free(it->chunk);
                exfat_error("failed to read directory cluster %#x", it->cluster);
                return -EIO;
        }