summaryrefslogtreecommitdiffstats
path: root/src/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-07-24 19:53:10 +0100
committerRoy Marples <roy@marples.name>2019-07-24 19:53:10 +0100
commitd9e888cd3decaaeac543dfecb7528970c42aa6e1 (patch)
tree15395c81481456e63b7a460e2830248dbb3f4c84 /src/dhcpcd.c
parent66d36d7edc43d65c2bf27f9ed0bc692c1fa3e6ec (diff)
downloaddhcpcd-d9e888cd3decaaeac543dfecb7528970c42aa6e1.tar.xz
Free script buffers before exiting from a fork.
Diffstat (limited to 'src/dhcpcd.c')
-rw-r--r--src/dhcpcd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 31267ab3..ac498a62 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -2125,6 +2125,12 @@ exit1:
}
free(ctx.ifaces);
}
+#ifdef HAVE_OPEN_MEMSTREAM
+ if (ctx.script_fp)
+ fclose(ctx.script_fp);
+#endif
+ free(ctx.script_buf);
+ free(ctx.script_env);
free_options(&ctx, ifo);
rt_dispose(&ctx);
free(ctx.duid);
@@ -2148,11 +2154,5 @@ exit1:
if (ctx.options & DHCPCD_FORKED)
_exit(i); /* so atexit won't remove our pidfile */
#endif
-#ifdef HAVE_OPEN_MEMSTREAM
- if (ctx.script_fp)
- fclose(ctx.script_fp);
-#endif
- free(ctx.script_buf);
- free(ctx.script_env);
return i;
}