Commit 5003bab8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

fix "scripts/mod/modpost.c: fix memory leak"

Fix error introduced by 37ed19d5
("scripts/mod/modpost.c: fix memory leak").

 - don't kfree("")

 - fix one missed conversion
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Tested-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Cc: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
Cc: Trevor Keith <tsrk@tsrk.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3d30701b
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include "modpost.h" #include "modpost.h"
#include "../../include/generated/autoconf.h" #include "../../include/generated/autoconf.h"
#include "../../include/linux/license.h" #include "../../include/linux/license.h"
...@@ -1217,7 +1218,7 @@ static char *sec2annotation(const char *s) ...@@ -1217,7 +1218,7 @@ static char *sec2annotation(const char *s)
strcat(p, " "); strcat(p, " ");
return r; /* we leak her but we do not care */ return r; /* we leak her but we do not care */
} else { } else {
return ""; return strdup("");
} }
} }
...@@ -1352,7 +1353,7 @@ static void report_sec_mismatch(const char *modname, ...@@ -1352,7 +1353,7 @@ static void report_sec_mismatch(const char *modname,
"%s%s so it may be used outside an exit section.\n", "%s%s so it may be used outside an exit section.\n",
from, prl_from, fromsym, from_p, from, prl_from, fromsym, from_p,
to, prl_to, tosym, to_p, to, prl_to, tosym, to_p,
sec2annotation(tosec), tosym, to_p); prl_to, tosym, to_p);
free(prl_from); free(prl_from);
free(prl_to); free(prl_to);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment