diff options
author | Lukas Fleischer <cgit@cryptocrack.de> | 2013-04-06 20:30:54 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-04-08 22:45:34 (JST) |
commit | 3edfd83db61f5dd2f046e6e8c21dfceeae03ed82 (patch) | |
tree | b29785135661b5f7bbb314b521b36351e021f142 | |
parent | 8f208794318f83826e98168b8b430f2d9a68bcce (diff) | |
download | cgit-3edfd83db61f5dd2f046e6e8c21dfceeae03ed82.zip cgit-3edfd83db61f5dd2f046e6e8c21dfceeae03ed82.tar.gz |
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.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -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'; |