aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/response.c')
-rw-r--r--src/daemon/response.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/daemon/response.c b/src/daemon/response.c
index 56333396..648b36a2 100644
--- a/src/daemon/response.c
+++ b/src/daemon/response.c
@@ -50,8 +50,19 @@ MHD_add_response_header (struct MHD_Response *response,
50 (NULL != strstr (content, "\r")) || (NULL != strstr (content, "\n"))) 50 (NULL != strstr (content, "\r")) || (NULL != strstr (content, "\n")))
51 return MHD_NO; 51 return MHD_NO;
52 hdr = malloc (sizeof (struct MHD_HTTP_Header)); 52 hdr = malloc (sizeof (struct MHD_HTTP_Header));
53 if (hdr == NULL)
54 return MHD_NO;
53 hdr->header = strdup (header); 55 hdr->header = strdup (header);
56 if (hdr->header == NULL) {
57 free(hdr);
58 return MHD_NO;
59 }
54 hdr->value = strdup (content); 60 hdr->value = strdup (content);
61 if (hdr->value == NULL) {
62 free(hdr->header);
63 free(hdr);
64 return MHD_NO;
65 }
55 hdr->kind = MHD_HEADER_KIND; 66 hdr->kind = MHD_HEADER_KIND;
56 hdr->next = response->first_header; 67 hdr->next = response->first_header;
57 response->first_header = hdr; 68 response->first_header = hdr;
@@ -132,6 +143,9 @@ const char *
132MHD_get_response_header (struct MHD_Response *response, const char *key) 143MHD_get_response_header (struct MHD_Response *response, const char *key)
133{ 144{
134 struct MHD_HTTP_Header *pos; 145 struct MHD_HTTP_Header *pos;
146
147 if (key == NULL)
148 return NULL;
135 pos = response->first_header; 149 pos = response->first_header;
136 while (pos != NULL) 150 while (pos != NULL)
137 { 151 {