Skip to content

Commit

Permalink
fix "scripts/mod/modpost.c: fix memory leak"
Browse files Browse the repository at this point in the history
Fix error introduced by 37ed19d
("scripts/mod/modpost.c: fix memory leak").

 - don't kfree("")

 - fix one missed conversion

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Tested-by: Stephen 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Aug 11, 2010
1 parent 3d30701 commit 5003bab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "modpost.h"
#include "../../include/generated/autoconf.h"
#include "../../include/linux/license.h"
Expand Down Expand Up @@ -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("");
}
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5003bab

Please sign in to comment.