about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLukas Fleischer2013-04-06 13:30:54 +0200
committerJason A. Donenfeld2013-04-08 15:45:34 +0200
commit3edfd83db61f5dd2f046e6e8c21dfceeae03ed82 (patch)
treeb29785135661b5f7bbb314b521b36351e021f142
parentAlways #include corresponding .h in .c files (diff)
downloadcgit-3edfd83db61f5dd2f046e6e8c21dfceeae03ed82.tar.gz
cgit-3edfd83db61f5dd2f046e6e8c21dfceeae03ed82.zip
html.c: Replace strdup() with xstrdup()
Use the xstrdup() wrapper which already bails out if strdup() returns a
NULL pointer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
-rw-r--r--html.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/html.c b/html.c index 1104f97..8c45ba6 100644 --- a/html.c +++ b/html.c
@@ -6,6 +6,7 @@
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h"
9#include "html.h" 10#include "html.h"
10#include <unistd.h> 11#include <unistd.h>
11#include <stdio.h> 12#include <stdio.h>
@@ -307,11 +308,7 @@ int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const
307 if (!txt_) 308 if (!txt_)
308 return 0; 309 return 0;
309 310
310 o = t = txt = strdup(txt_); 311 o = t = txt = xstrdup(txt_);
311 if (t == NULL) {
312 printf("Out of memory\n");
313 exit(1);
314 }
315 while ((c=*t) != '\0') { 312 while ((c=*t) != '\0') {
316 if (c == '=') { 313 if (c == '=') {
317 *t = '\0'; 314 *t = '\0';