diff options
Diffstat (limited to 'src/daemon/response.c')
-rw-r--r-- | src/daemon/response.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/daemon/response.c b/src/daemon/response.c index 160246eb..ea1fe9c0 100644 --- a/src/daemon/response.c +++ b/src/daemon/response.c | |||
@@ -226,6 +226,8 @@ MHD_create_response_from_data (size_t size, | |||
226 | if ((data == NULL) && (size > 0)) | 226 | if ((data == NULL) && (size > 0)) |
227 | return NULL; | 227 | return NULL; |
228 | retVal = malloc (sizeof (struct MHD_Response)); | 228 | retVal = malloc (sizeof (struct MHD_Response)); |
229 | if (retVal == NULL) | ||
230 | return NULL; | ||
229 | memset (retVal, 0, sizeof (struct MHD_Response)); | 231 | memset (retVal, 0, sizeof (struct MHD_Response)); |
230 | if (pthread_mutex_init (&retVal->mutex, NULL) != 0) | 232 | if (pthread_mutex_init (&retVal->mutex, NULL) != 0) |
231 | { | 233 | { |
@@ -235,6 +237,11 @@ MHD_create_response_from_data (size_t size, | |||
235 | if ((must_copy) && (size > 0)) | 237 | if ((must_copy) && (size > 0)) |
236 | { | 238 | { |
237 | tmp = malloc (size); | 239 | tmp = malloc (size); |
240 | if (tmp == NULL) | ||
241 | { | ||
242 | free(retVal); | ||
243 | return NULL; | ||
244 | } | ||
238 | memcpy (tmp, data, size); | 245 | memcpy (tmp, data, size); |
239 | must_free = 1; | 246 | must_free = 1; |
240 | data = tmp; | 247 | data = tmp; |