Christian Grothoff 18 лет назад
Родитель
Сommit
c2968619ef
4 измененных файлов с 17 добавлено и 1 удалено
  1. 3 0
      AUTHORS
  2. 5 0
      src/daemon/daemon.c
  3. 2 1
      src/daemon/minimal_example.c
  4. 7 0
      src/daemon/response.c

+ 3 - 0
AUTHORS

@@ -7,3 +7,6 @@ Elliot Glaysher
 Daniel Pittman <[email protected]>
 Nils Durner <[email protected]>
 Heikki Lindholm <[email protected]>
+
+Documentation contributions also came from:
+Marco Maggi <[email protected]>

+ 5 - 0
src/daemon/daemon.c

@@ -596,6 +596,11 @@ MHD_start_daemon (unsigned int options,
       return NULL;
     }
   retVal = malloc (sizeof (struct MHD_Daemon));
+  if (retVal == NULL)
+    {
+      CLOSE(socket_fd);
+      return NULL;
+    }
   memset (retVal, 0, sizeof (struct MHD_Daemon));
   retVal->options = options;
   retVal->port = port;

+ 2 - 1
src/daemon/minimal_example.c

@@ -40,8 +40,9 @@ ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
           const char *method,
+	  const char *version,
           const char *upload_data,
-          const char *version, unsigned int *upload_data_size, void **ptr)
+	  unsigned int *upload_data_size, void **ptr)
 {
   static int aptr;
   const char *me = cls;

+ 7 - 0
src/daemon/response.c

@@ -226,6 +226,8 @@ MHD_create_response_from_data (size_t size,
   if ((data == NULL) && (size > 0))
     return NULL;
   retVal = malloc (sizeof (struct MHD_Response));
+  if (retVal == NULL)
+    return NULL;
   memset (retVal, 0, sizeof (struct MHD_Response));
   if (pthread_mutex_init (&retVal->mutex, NULL) != 0)
     {
@@ -235,6 +237,11 @@ MHD_create_response_from_data (size_t size,
   if ((must_copy) && (size > 0))
     {
       tmp = malloc (size);
+      if (tmp == NULL)
+	{
+	  free(retVal);
+	  return NULL;
+	}
       memcpy (tmp, data, size);
       must_free = 1;
       data = tmp;