Index: /trunk/src/VBox/Devices/Network/lwip-new/src/api/netdb.c
===================================================================
--- /trunk/src/VBox/Devices/Network/lwip-new/src/api/netdb.c	(revision 83560)
+++ /trunk/src/VBox/Devices/Network/lwip-new/src/api/netdb.c	(revision 83561)
@@ -315,5 +315,5 @@
   ai = (struct addrinfo *)memp_malloc(MEMP_NETDB);
   if (ai == NULL) {
-    goto memerr;
+    return EAI_MEMORY;
   }
   memset(ai, 0, total_size);
@@ -344,9 +344,4 @@
 
   return 0;
-memerr:
-  if (ai != NULL) {
-    memp_free(MEMP_NETDB, ai);
-  }
-  return EAI_MEMORY;
 }
 
Index: /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/igmp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/igmp.c	(revision 83560)
+++ /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/igmp.c	(revision 83561)
@@ -697,10 +697,19 @@
 {
   /* ensure the input value is > 0 */
+#ifdef LWIP_RAND
   if (max_time == 0) {
     max_time = 1;
   }
-#ifdef LWIP_RAND
   /* ensure the random value is > 0 */
   group->timer = (LWIP_RAND() % max_time);
+  if (group->timer == 0) {
+    group->timer = 1;
+  }
+#else /* LWIP_RAND */
+  /* ATTENTION: use this only if absolutely necessary! */
+  group->timer = max_time / 2;
+  if (group->timer == 0) {
+    group->timer = 1;
+  }
 #endif /* LWIP_RAND */
 }
Index: /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/mld6.c
===================================================================
--- /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/mld6.c	(revision 83560)
+++ /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/mld6.c	(revision 83561)
@@ -500,5 +500,8 @@
 #ifdef LWIP_RAND
   /* Randomize maxresp. (if LWIP_RAND is supported) */
-  maxresp = (LWIP_RAND() % (maxresp - 1)) + 1;
+  maxresp = LWIP_RAND() % maxresp;
+  if (maxresp == 0) {
+    maxresp = 1;
+  }
 #endif /* LWIP_RAND */
 
Index: /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/nd6.c
===================================================================
--- /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/nd6.c	(revision 83560)
+++ /trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/nd6.c	(revision 83561)
@@ -505,4 +505,5 @@
         if (prefix_opt->flags & ND6_PREFIX_FLAG_ON_LINK) {
           /* Add to on-link prefix list. */
+          s8_t prefix;
 
           /* Get a memory-aligned copy of the prefix. */
@@ -510,11 +511,11 @@
 
           /* find cache entry for this prefix. */
-          i = nd6_get_onlink_prefix(ip6_current_dest_addr(), inp);
-          if (i < 0) {
+          prefix = nd6_get_onlink_prefix(ip6_current_dest_addr(), inp);
+          if (prefix < 0) {
             /* Create a new cache entry. */
-            i = nd6_new_onlink_prefix(ip6_current_dest_addr(), inp);
+            prefix = nd6_new_onlink_prefix(ip6_current_dest_addr(), inp);
           }
-          if (i >= 0) {
-            prefix_list[i].invalidation_timer = prefix_opt->valid_lifetime;
+          if (prefix >= 0) {
+            prefix_list[prefix].invalidation_timer = prefix_opt->valid_lifetime;
 
 #if LWIP_IPV6_AUTOCONFIG
@@ -522,5 +523,5 @@
               /* Mark prefix as autonomous, so that address autoconfiguration can take place.
                * Only OR flag, so that we don't over-write other flags (such as ADDRESS_DUPLICATE)*/
-              prefix_list[i].flags |= ND6_PREFIX_AUTOCONFIG_AUTONOMOUS;
+              prefix_list[prefix].flags |= ND6_PREFIX_AUTOCONFIG_AUTONOMOUS;
             }
 #endif /* LWIP_IPV6_AUTOCONFIG */
