modpost: free allocated memory
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 2 Aug 2016 19:43:01 +0000 (21:43 +0200)
committerJessica Yu <jeyu@redhat.com>
Sat, 26 Nov 2016 19:18:01 +0000 (11:18 -0800)
valgrind complains that memory is not freed after allocation
with realloc() called from main() and write_dump().

So let us free the allocated memory properly.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Link: http://lkml.kernel.org/r/1470166981-6461-1-git-send-email-xypron.glpk@gmx.de
Signed-off-by: Jessica Yu <jeyu@redhat.com>
scripts/mod/modpost.c

index bd834975909510335322ec8f34970573a8708dfc..5a6b39a29b7a781eb9bf9e10d24b336c46c38bea 100644 (file)
@@ -2371,6 +2371,7 @@ static void write_dump(const char *fname)
                }
        }
        write_if_changed(&buf, fname);
+       free(buf.p);
 }
 
 struct ext_sym_list {
@@ -2496,6 +2497,7 @@ int main(int argc, char **argv)
                              "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
                }
        }
+       free(buf.p);
 
        return err;
 }