Browse Source

fdtput.c: Fix memory leak.

CID 132821 (#1 of 1): Resource leak (RESOURCE_LEAK)
12. leaked_storage: Variable value 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>
main
Jean-Christophe Dubois 9 years ago committed by David Gibson
parent
commit
c539075ba8
  1. 7
      fdtput.c

7
fdtput.c

@ -328,7 +328,7 @@ static int delete_node(char *blob, const char *node_name) @@ -328,7 +328,7 @@ static int delete_node(char *blob, const char *node_name)
static int do_fdtput(struct display_info *disp, const char *filename,
char **arg, int arg_count)
{
char *value;
char *value = NULL;
char *blob;
char *node;
int len, ret = 0;
@ -374,6 +374,11 @@ static int do_fdtput(struct display_info *disp, const char *filename, @@ -374,6 +374,11 @@ static int do_fdtput(struct display_info *disp, const char *filename,
}

free(blob);

if (value) {
free(value);
}

return ret;
}


Loading…
Cancel
Save