From: Andrew Morton Date: Wed, 11 Aug 2010 07:42:26 +0000 (-0700) Subject: fix "scripts/mod/modpost.c: fix memory leak" X-Git-Tag: firefly_0821_release~9833^2~1014 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5003bab82d56754b27be01eef24495a02e00039d;p=firefly-linux-kernel-4.4.55.git fix "scripts/mod/modpost.c: fix memory leak" Fix error introduced by 37ed19d5cce35a40d3913cf9aa208ce9f60db3d7 ("scripts/mod/modpost.c: fix memory leak"). - don't kfree("") - fix one missed conversion Reported-by: Stephen Rothwell Tested-by: Stephen Rothwell Cc: Alexey Fomenko Cc: Trevor Keith Cc: Rusty Russell Cc: Michal Marek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 1ce655dde99e..7acbdd8fcaed 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -14,6 +14,7 @@ #define _GNU_SOURCE #include #include +#include #include "modpost.h" #include "../../include/generated/autoconf.h" #include "../../include/linux/license.h" @@ -1217,7 +1218,7 @@ static char *sec2annotation(const char *s) strcat(p, " "); return r; /* we leak her but we do not care */ } else { - return ""; + return strdup(""); } } @@ -1352,7 +1353,7 @@ static void report_sec_mismatch(const char *modname, "%s%s so it may be used outside an exit section.\n", from, prl_from, fromsym, from_p, to, prl_to, tosym, to_p, - sec2annotation(tosec), tosym, to_p); + prl_to, tosym, to_p); free(prl_from); free(prl_to); break;