p2pd: fir compile warning, initialise ipHeader
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 9 Aug 2014 10:33:22 +0000 (12:33 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 9 Aug 2014 10:40:05 +0000 (12:40 +0200)
When compiling with the address sanitiser, got

[CC] src/p2pd.c
src/p2pd.c: In function ‘DoP2pd’:
src/p2pd.c:629:18: warning: ‘ipHeader’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   nwords = header->ip_hl << 1;
                  ^
src/p2pd.c:663:14: note: ‘ipHeader’ was declared here
   struct ip *ipHeader;         /* The IP header inside the captured IP packet */
              ^

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/p2pd/src/p2pd.c

index 6e3f98c..e0e920b 100644 (file)
@@ -660,7 +660,7 @@ static void
 P2pdPacketCaptured(unsigned char *encapsulationUdpData, int nBytes)
 {
   union olsr_ip_addr dst;      /* Destination IP address in captured packet */
-  struct ip *ipHeader;         /* The IP header inside the captured IP packet */
+  struct ip *ipHeader = NULL;  /* The IP header inside the captured IP packet */
   struct ip6_hdr *ipHeader6;   /* The IP header inside the captured IP packet */
   struct udphdr *udpHeader;
   uint8_t * ttl = NULL;