gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28206 - in libmicrohttpd/src: testcurl testzzuf


From: gnunet
Subject: [GNUnet-SVN] r28206 - in libmicrohttpd/src: testcurl testzzuf
Date: Fri, 19 Jul 2013 22:15:32 +0200

Author: grothoff
Date: 2013-07-19 22:15:31 +0200 (Fri, 19 Jul 2013)
New Revision: 28206

Modified:
   libmicrohttpd/src/testcurl/test_post.c
   libmicrohttpd/src/testcurl/test_postform.c
   libmicrohttpd/src/testzzuf/test_post.c
   libmicrohttpd/src/testzzuf/test_post_form.c
Log:
-fixing memory leaks in testcases

Modified: libmicrohttpd/src/testcurl/test_post.c
===================================================================
--- libmicrohttpd/src/testcurl/test_post.c      2013-07-19 16:48:12 UTC (rev 
28205)
+++ libmicrohttpd/src/testcurl/test_post.c      2013-07-19 20:15:31 UTC (rev 
28206)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file daemontest_post.c
+ * @file test_postx.c
  * @brief  Testcase for libmicrohttpd POST operations using URL-encoding
  * @author Christian Grothoff
  */
@@ -47,6 +47,21 @@
   size_t size;
 };
 
+
+static void
+completed_cb (void *cls,
+             struct MHD_Connection *connection,
+             void **con_cls,
+             enum MHD_RequestTerminationCode toe)
+{
+  struct MHD_PostProcessor *pp = *con_cls;
+
+  if (NULL != pp)
+    MHD_destroy_post_processor (pp);
+  *con_cls = NULL;
+}
+
+
 static size_t
 copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 {
@@ -59,6 +74,7 @@
   return size * nmemb;
 }
 
+
 /**
  * Note that this post_iterator is not perfect
  * in that it fails to support incremental processing.
@@ -140,7 +156,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
-                        1080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1080, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 1;
   c = curl_easy_init ();
@@ -192,7 +210,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
-                        1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1081, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 16;
   c = curl_easy_init ();
@@ -245,7 +265,9 @@
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
                         1081, NULL, NULL, &ahc_echo, NULL,
-                        MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END);
+                        MHD_OPTION_THREAD_POOL_SIZE, 4, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 16;
   c = curl_easy_init ();
@@ -307,7 +329,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_DEBUG,
-                        1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1082, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 256;
   c = curl_easy_init ();
@@ -507,7 +531,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
-                        1081, NULL, NULL, &ahc_cancel, NULL, MHD_OPTION_END);
+                        1081, NULL, NULL, &ahc_cancel, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 32768;
 

Modified: libmicrohttpd/src/testcurl/test_postform.c
===================================================================
--- libmicrohttpd/src/testcurl/test_postform.c  2013-07-19 16:48:12 UTC (rev 
28205)
+++ libmicrohttpd/src/testcurl/test_postform.c  2013-07-19 20:15:31 UTC (rev 
28206)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file daemontest_post.c
+ * @file test_postform.c
  * @brief  Testcase for libmicrohttpd POST operations using multipart/postform 
data
  * @author Christian Grothoff
  */
@@ -45,6 +45,21 @@
   size_t size;
 };
 
+
+static void
+completed_cb (void *cls,
+             struct MHD_Connection *connection,
+             void **con_cls,
+             enum MHD_RequestTerminationCode toe)
+{
+  struct MHD_PostProcessor *pp = *con_cls;
+
+  if (NULL != pp)
+    MHD_destroy_post_processor (pp);
+  *con_cls = NULL;
+}
+
+
 static size_t
 copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 {
@@ -57,6 +72,7 @@
   return size * nmemb;
 }
 
+
 /**
  * Note that this post_iterator is not perfect
  * in that it fails to support incremental processing.
@@ -85,6 +101,7 @@
   return MHD_YES;
 }
 
+
 static int
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
@@ -157,7 +174,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
-                        1080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1080, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 1;
   c = curl_easy_init ();
@@ -211,7 +230,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
-                        1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1081, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 16;
   c = curl_easy_init ();
@@ -266,7 +287,9 @@
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
                         1081, NULL, NULL, &ahc_echo, NULL,
-                        MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END);
+                        MHD_OPTION_THREAD_POOL_SIZE, 4, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 16;
   c = curl_easy_init ();
@@ -330,7 +353,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_DEBUG,
-                        1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1082, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 256;
   c = curl_easy_init ();

Modified: libmicrohttpd/src/testzzuf/test_post.c
===================================================================
--- libmicrohttpd/src/testzzuf/test_post.c      2013-07-19 16:48:12 UTC (rev 
28205)
+++ libmicrohttpd/src/testzzuf/test_post.c      2013-07-19 20:15:31 UTC (rev 
28206)
@@ -50,6 +50,21 @@
   size_t size;
 };
 
+
+static void
+completed_cb (void *cls,
+             struct MHD_Connection *connection,
+             void **con_cls,
+             enum MHD_RequestTerminationCode toe)
+{
+  struct MHD_PostProcessor *pp = *con_cls;
+
+  if (NULL != pp)
+    MHD_destroy_post_processor (pp);
+  *con_cls = NULL;
+}
+
+
 static size_t
 copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 {
@@ -62,6 +77,7 @@
   return size * nmemb;
 }
 
+
 /**
  * Note that this post_iterator is not perfect
  * in that it fails to support incremental processing.
@@ -142,7 +158,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ ,
-                        11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        11080, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 1;
   zzuf_socat_start ();
@@ -191,7 +209,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ ,
-                        11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        11080, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+                       MHD_OPTION_END);
   if (d == NULL)
     return 16;
 
@@ -252,7 +272,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_DEBUG */ ,
-                        1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1082, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+                       MHD_OPTION_END);
   if (d == NULL)
     return 256;
   multi = curl_multi_init ();

Modified: libmicrohttpd/src/testzzuf/test_post_form.c
===================================================================
--- libmicrohttpd/src/testzzuf/test_post_form.c 2013-07-19 16:48:12 UTC (rev 
28205)
+++ libmicrohttpd/src/testzzuf/test_post_form.c 2013-07-19 20:15:31 UTC (rev 
28206)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file daemontest_post.c
+ * @file test_post_form.c
  * @brief  Testcase for libmicrohttpd POST operations using multipart/postform 
data
  * @author Christian Grothoff
  */
@@ -48,6 +48,21 @@
   size_t size;
 };
 
+
+static void
+completed_cb (void *cls,
+             struct MHD_Connection *connection,
+             void **con_cls,
+             enum MHD_RequestTerminationCode toe)
+{
+  struct MHD_PostProcessor *pp = *con_cls;
+
+  if (NULL != pp)
+    MHD_destroy_post_processor (pp);
+  *con_cls = NULL;
+}
+
+
 static size_t
 copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 {
@@ -90,6 +105,7 @@
   return MHD_YES;
 }
 
+
 static int
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
@@ -161,7 +177,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ ,
-                        11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        11080, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+                       MHD_OPTION_END);
   if (d == NULL)
     return 1;
   zzuf_socat_start ();
@@ -195,6 +213,7 @@
   return 0;
 }
 
+
 static int
 testMultithreadedPost ()
 {
@@ -209,7 +228,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ ,
-                        11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        11080, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+                       MHD_OPTION_END);
   if (d == NULL)
     return 16;
   zzuf_socat_start ();
@@ -268,7 +289,9 @@
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_DEBUG */ ,
-                        1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        1082, NULL, NULL, &ahc_echo, NULL, 
+                       MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,       
                
+                       MHD_OPTION_END);
   if (d == NULL)
     return 256;
   multi = curl_multi_init ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]