From bc7e81adccb08c87f2165a55d2cc46c3fac6514e Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 2 Apr 2001 17:07:19 +0000 Subject: don't free something not malloc()ed --- src/usernetctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/usernetctl.c') diff --git a/src/usernetctl.c b/src/usernetctl.c index cfc45cdc..34a6550c 100644 --- a/src/usernetctl.c +++ b/src/usernetctl.c @@ -58,6 +58,7 @@ testSafe(char *ifaceConfig) { static int userCtl(char *file) { + char *buf; char *contents = NULL; char *chptr = NULL; char *next = NULL; @@ -66,7 +67,7 @@ userCtl(char *file) { size = testSafe(file); - contents = malloc(size + 2); + buf = contents = malloc(size + 2); if ((fd = open(file, O_RDONLY)) == -1) { fprintf(stderr, "failed to open %s: %s\n", file, strerror(errno)); @@ -110,7 +111,7 @@ userCtl(char *file) { contents = next; } - free(contents); + free(buf); return retval; } -- cgit v1.2.1