aboutsummaryrefslogtreecommitdiff
path: root/src/examples/post_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/post_example.c')
-rw-r--r--src/examples/post_example.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index b1a6e7fa..528b8678 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -284,6 +284,8 @@ serve_simple_form (const void *cls,
284 response = MHD_create_response_from_buffer (strlen (form), 284 response = MHD_create_response_from_buffer (strlen (form),
285 (void *) form, 285 (void *) form,
286 MHD_RESPMEM_PERSISTENT); 286 MHD_RESPMEM_PERSISTENT);
287 if (NULL == response)
288 return MHD_NO;
287 add_session_cookie (session, response); 289 add_session_cookie (session, response);
288 MHD_add_response_header (response, 290 MHD_add_response_header (response,
289 MHD_HTTP_HEADER_CONTENT_ENCODING, 291 MHD_HTTP_HEADER_CONTENT_ENCODING,
@@ -316,6 +318,8 @@ fill_v1_form (const void *cls,
316 struct MHD_Response *response; 318 struct MHD_Response *response;
317 319
318 reply = malloc (strlen (form) + strlen (session->value_1) + 1); 320 reply = malloc (strlen (form) + strlen (session->value_1) + 1);
321 if (NULL == reply)
322 return NULL;
319 snprintf (reply, 323 snprintf (reply,
320 strlen (form) + strlen (session->value_1) + 1, 324 strlen (form) + strlen (session->value_1) + 1,
321 form, 325 form,
@@ -324,6 +328,8 @@ fill_v1_form (const void *cls,
324 response = MHD_create_response_from_buffer (strlen (reply), 328 response = MHD_create_response_from_buffer (strlen (reply),
325 (void *) reply, 329 (void *) reply,
326 MHD_RESPMEM_MUST_FREE); 330 MHD_RESPMEM_MUST_FREE);
331 if (NULL == response)
332 return MHD_NO;
327 add_session_cookie (session, response); 333 add_session_cookie (session, response);
328 MHD_add_response_header (response, 334 MHD_add_response_header (response,
329 MHD_HTTP_HEADER_CONTENT_ENCODING, 335 MHD_HTTP_HEADER_CONTENT_ENCODING,
@@ -356,6 +362,8 @@ fill_v1_v2_form (const void *cls,
356 struct MHD_Response *response; 362 struct MHD_Response *response;
357 363
358 reply = malloc (strlen (form) + strlen (session->value_1) + strlen (session->value_2) + 1); 364 reply = malloc (strlen (form) + strlen (session->value_1) + strlen (session->value_2) + 1);
365 if (NULL == reply)
366 return MHD_NO;
359 snprintf (reply, 367 snprintf (reply,
360 strlen (form) + strlen (session->value_1) + strlen (session->value_2) + 1, 368 strlen (form) + strlen (session->value_1) + strlen (session->value_2) + 1,
361 form, 369 form,
@@ -364,6 +372,8 @@ fill_v1_v2_form (const void *cls,
364 response = MHD_create_response_from_buffer (strlen (reply), 372 response = MHD_create_response_from_buffer (strlen (reply),
365 (void *) reply, 373 (void *) reply,
366 MHD_RESPMEM_MUST_FREE); 374 MHD_RESPMEM_MUST_FREE);
375 if (NULL == response)
376 return MHD_NO;
367 add_session_cookie (session, response); 377 add_session_cookie (session, response);
368 MHD_add_response_header (response, 378 MHD_add_response_header (response,
369 MHD_HTTP_HEADER_CONTENT_ENCODING, 379 MHD_HTTP_HEADER_CONTENT_ENCODING,
@@ -397,6 +407,8 @@ not_found_page (const void *cls,
397 response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR), 407 response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR),
398 (void *) NOT_FOUND_ERROR, 408 (void *) NOT_FOUND_ERROR,
399 MHD_RESPMEM_PERSISTENT); 409 MHD_RESPMEM_PERSISTENT);
410 if (NULL == response)
411 return MHD_NO;
400 ret = MHD_queue_response (connection, 412 ret = MHD_queue_response (connection,
401 MHD_HTTP_NOT_FOUND, 413 MHD_HTTP_NOT_FOUND,
402 response); 414 response);