Skip to content

Commit c7d47f2

Browse files
xypronJessica Yu
authored andcommitted
modpost: free allocated memory
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>
1 parent a25f094 commit c7d47f2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎scripts/mod/modpost.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,6 +2371,7 @@ static void write_dump(const char *fname)
23712371
}
23722372
}
23732373
write_if_changed(&buf, fname);
2374+
free(buf.p);
23742375
}
23752376

23762377
struct ext_sym_list {
@@ -2496,6 +2497,7 @@ int main(int argc, char **argv)
24962497
"Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
24972498
}
24982499
}
2500+
free(buf.p);
24992501

25002502
return err;
25012503
}

0 commit comments

Comments
 (0)