On Wed, Jul 13, 2016 at 12:36:21AM +0200, Jean-Christophe Dubois wrote: > 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@xxxxxxxxxxxxxxx> As with fdtput, because the program exits immediately after, there's really no point to this free(). > --- > fdtput.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fdtput.c b/fdtput.c > index 9b15c53..db65e96 100644 > --- a/fdtput.c > +++ b/fdtput.c > @@ -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, > } > > free(blob); > + > + if (value) { > + free(value); > + } > + > return ret; > } > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature