The variable "buf" passed into find_collision() as parameter "name" should be freed on unsuccessful returns.
Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
---
btrfs-image.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/btrfs-image.c b/btrfs-image.c
index 3ea3730..1a52aa6 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -284,6 +284,7 @@ static char *find_collision(struct metadump_struct *md, char *name,
val = malloc(sizeof(struct name));
if (!val) {
fprintf(stderr, "Couldn't sanitize name, enomem\n");
+ free(name);
return NULL;
}
@@ -295,6 +296,7 @@ static char *find_collision(struct metadump_struct *md, char *name,
if (!val->sub) {
fprintf(stderr, "Couldn't sanitize name, enomem\n");
free(val);
+ free(name);
return NULL;
}
--
1.8.0.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html