internally assert that asprintf size allocation never fails
authorChristian Grothoff <christian@grothoff.org>
Sat, 6 Jan 2018 20:22:23 +0000 (21:22 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 6 Jan 2018 20:22:23 +0000 (21:22 +0100)
src/transport/plugin_transport_tcp.c
src/util/common_allocation.c
src/util/configuration.c

index c5d6e6d345389f384b890e882535cc5ab79a48b0..8b00543c3df57e9d055679b7d0db3be2f3320d51 100644 (file)
@@ -3351,9 +3351,10 @@ handle_tcp_data (void *cls,
     void *vaddr = NULL;
     size_t alen;
 
-    GNUNET_SERVER_client_get_address (client,
-                                      &vaddr,
-                                      &alen);
+    GNUNET_assert (GNUNET_OK ==
+                  GNUNET_SERVER_client_get_address (client,
+                                                    &vaddr,
+                                                    &alen));
     LOG (GNUNET_ERROR_TYPE_ERROR,
          "Received unexpected %u bytes of type %u from `%s'\n",
          (unsigned int) ntohs (message->size),
index be2538c3f4c941661bb5e1c012df2baccf27210c..80047bb5269d01b0bb4a787962e3a483b2d8e311 100644 (file)
@@ -484,6 +484,7 @@ GNUNET_asprintf (char **buf,
   va_start (args, format);
   ret = VSNPRINTF (NULL, 0, format, args);
   va_end (args);
+  GNUNET_assert (ret >= 0);
   *buf = GNUNET_malloc (ret + 1);
   va_start (args, format);
   ret = VSPRINTF (*buf, format, args);
index 7f1d98902a33a9d9e76623c826f69b0f9b298189..25eeaf80fcb4dc0ce0298cc6372810475dcde37e 100644 (file)
@@ -421,7 +421,6 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
   size_t m_size;
   size_t c_size;
 
-
   /* Pass1 : calculate the buffer size required */
   m_size = 0;
   for (sec = cfg->sections; NULL != sec; sec = sec->next)