btrfs-progs: free local variable buf upon unsuccessful returns

The variable "buf" passed into find_collision() as parameter "name"
should be freed on unsuccessful returns.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
master
Gui Hecheng 2013-09-05 10:38:54 +08:00 committed by Chris Mason
parent 5991043ea4
commit 0f2569b126
1 changed files with 2 additions and 0 deletions

View File

@ -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;
}