]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
if-linux: fix a potential NULL de-reference
authorRoy Marples <roy@marples.name>
Mon, 6 Nov 2017 21:51:34 +0000 (21:51 +0000)
committerRoy Marples <roy@marples.name>
Mon, 6 Nov 2017 21:51:34 +0000 (21:51 +0000)
src/if-linux.c

index 0d49ab6b5b8c9769c707cbdceeb6a031223d1932..647e12617adb0c20e55fcd9d8afdb314039b0c59 100644 (file)
@@ -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;
 }