From: Cong Wang <xiyou.wangcong@xxxxxxxxx> Marek reported there is a memory leak in lib/mangle.c CC mangle.o mangle.c:160:9: warning: Memory is never released; potential leak of memory pointed to by 'ss' This patch fixes it. Reported-by: Marek Otahal <markotahal@xxxxxxxxx> Cc: Karel Zak <kzak@xxxxxxxxxx> Signed-off-by: Cong Wang <xiyou.wangcong@xxxxxxxxx> --- diff --git a/lib/mangle.c b/lib/mangle.c index 656918c..faddeb8 100644 --- a/lib/mangle.c +++ b/lib/mangle.c @@ -131,14 +131,18 @@ char *unmangle(const char *s, char **end) #include <errno.h> int main(int argc, char *argv[]) { + char *p = NULL; if (argc < 3) { fprintf(stderr, "usage: %s --mangle|unmangle <string>\n", program_invocation_short_name); return EXIT_FAILURE; } - if (!strcmp(argv[1], "--mangle")) - printf("mangled: '%s'\n", mangle(argv[2])); + if (!strcmp(argv[1], "--mangle")) { + p = mangle(argv[2]); + printf("mangled: '%s'\n", p); + free(p); + } else if (!strcmp(argv[1], "--unmangle")) { char *x = unmangle(argv[2], NULL); -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html