From: Roy Marples Date: Mon, 6 Nov 2017 21:51:34 +0000 (+0000) Subject: if-linux: fix a potential NULL de-reference X-Git-Tag: v7.0.0-rc4~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea2f85108760c02afbf68c2e63b3d8339614f976;p=thirdparty%2Fdhcpcd.git if-linux: fix a potential NULL de-reference --- diff --git a/src/if-linux.c b/src/if-linux.c index 0d49ab6b..647e1261 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -1376,8 +1376,10 @@ bpf_open(struct interface *ifp, int (*filter)(struct interface *, int)) return s; eexit: - free(state->buffer); - state->buffer = NULL; + if (state != NULL) { + free(state->buffer); + state->buffer = NULL; + } close(s); return -1; }