From: Roy Marples Date: Wed, 12 Feb 2014 10:27:29 +0000 (+0000) Subject: Remove needless malloc X-Git-Tag: v6.3.0~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60dad20dbdd955c1a781f4a860736d9535d544cb;p=thirdparty%2Fdhcpcd.git Remove needless malloc --- diff --git a/bpf.c b/bpf.c index 96e07ce6..6617f060 100644 --- a/bpf.c +++ b/bpf.c @@ -64,17 +64,13 @@ ipv4_opensocket(struct interface *ifp, int protocol) #ifdef _PATH_BPF fd = open(_PATH_BPF, O_RDWR | O_CLOEXEC | O_NONBLOCK); #else - char *device; + char device[PATH_MAX]; int n = 0; - device = malloc(sizeof(char) * PATH_MAX); - if (device == NULL) - return -1; do { snprintf(device, PATH_MAX, "/dev/bpf%d", n++); fd = open(device, O_RDWR | O_CLOEXEC | O_NONBLOCK); } while (fd == -1 && errno == EBUSY); - free(device); #endif if (fd == -1)