changeset 2450:d64ad6b8a38a draft

Fix an unassigned memory error.
author Roy Marples <roy@marples.name>
date Wed, 30 Apr 2014 09:35:48 +0000
parents 90584a833678
children 728116e38471
files if-linux.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/if-linux.c	Mon Apr 28 23:56:21 2014 +0000
+++ b/if-linux.c	Wed Apr 30 09:35:48 2014 +0000
@@ -773,9 +773,6 @@
 	        return -1;
 	}
 #endif
-	su.sll.sll_family = PF_PACKET;
-	su.sll.sll_protocol = htons(protocol);
-	su.sll.sll_ifindex = (int)ifp->index;
 	/* Install the DHCP filter */
 	memset(&pf, 0, sizeof(pf));
 	if (protocol == ETHERTYPE_ARP) {
@@ -794,6 +791,11 @@
 			goto eexit;
 	}
 #endif
+
+	memset(&su, 0, sizeof(su));
+	su.sll.sll_family = PF_PACKET;
+	su.sll.sll_protocol = htons(protocol);
+	su.sll.sll_ifindex = (int)ifp->index;
 	if (bind(s, &su.sa, sizeof(su)) == -1)
 		goto eexit;
 	return s;