nixpkgs/pkgs/tools/networking/dhcpcd/reload.patch

27 lines
597 B
Diff
Raw Normal View History

Fix segfault when reloading the configuration: free_globals() left the
ifac/ifdc variables at -1 instead of 0, causing a crash later in
splitv().
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -143,16 +143,18 @@
if (ctx->ifac) {
for (ctx->ifac--; ctx->ifac >= 0; ctx->ifac--)
free(ctx->ifav[ctx->ifac]);
free(ctx->ifav);
ctx->ifav = NULL;
+ ctx->ifac = 0;
}
if (ctx->ifdc) {
for (ctx->ifdc--; ctx->ifdc >= 0; ctx->ifdc--)
free(ctx->ifdv[ctx->ifdc]);
free(ctx->ifdv);
ctx->ifdv = NULL;
+ ctx->ifdc = 0;
}
#ifdef INET
if (ctx->dhcp_opts) {
for (opt = ctx->dhcp_opts;