aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-04-02 17:07:19 +0000
committerBill Nottingham <notting@redhat.com>2001-04-02 17:07:19 +0000
commitbc7e81adccb08c87f2165a55d2cc46c3fac6514e (patch)
tree4ff16049ad34c1bbde0e748fb75cb9977e0eae70
parentbef0a79f5ad21126c1b1cb0db5ff2d740414eef5 (diff)
downloadinitscripts-bc7e81adccb08c87f2165a55d2cc46c3fac6514e.tar
initscripts-bc7e81adccb08c87f2165a55d2cc46c3fac6514e.tar.gz
initscripts-bc7e81adccb08c87f2165a55d2cc46c3fac6514e.tar.bz2
initscripts-bc7e81adccb08c87f2165a55d2cc46c3fac6514e.tar.xz
initscripts-bc7e81adccb08c87f2165a55d2cc46c3fac6514e.zip
don't free something not malloc()ed
-rw-r--r--src/usernetctl.c5
1 files changed, 3 insertions, 2 deletions
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;
}