fdtget.c: Fix memory leak
CID 132823 (#1 of 1): Resource leak (RESOURCE_LEAK) 5. leaked_storage: Variable blob going out of scope leaks the storage it points to. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
1074ee54b6
commit
f79ddb83e1
1 changed files with 7 additions and 1 deletions
8
fdtget.c
8
fdtget.c
|
@ -266,14 +266,20 @@ static int do_fdtget(struct display_info *disp, const char *filename,
|
|||
continue;
|
||||
} else {
|
||||
report_error(arg[i], node);
|
||||
free(blob);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
prop = args_per_step == 1 ? NULL : arg[i + 1];
|
||||
|
||||
if (show_data_for_item(blob, disp, node, prop))
|
||||
if (show_data_for_item(blob, disp, node, prop)) {
|
||||
free(blob);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
free(blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue