libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit c2968619ef48cd5cfa9de2e07b1db0007ba395f4
parent 435bef8e63a33d0ed303edd2a0dc89574174ddd5
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 30 Dec 2007 20:08:22 +0000

docs and bugfixes

Diffstat:
MAUTHORS | 3+++
Msrc/daemon/daemon.c | 5+++++
Msrc/daemon/minimal_example.c | 3++-
Msrc/daemon/response.c | 7+++++++
4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/AUTHORS b/AUTHORS @@ -7,3 +7,6 @@ Elliot Glaysher Daniel Pittman <depittman@gmail.com> Nils Durner <durner@gnunet.org> Heikki Lindholm <holindho@cs.helsinki.fi> + +Documentation contributions also came from: +Marco Maggi <marco.maggi-ipsu@poste.it> diff --git a/src/daemon/daemon.c b/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; diff --git a/src/daemon/minimal_example.c b/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; diff --git a/src/daemon/response.c b/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;