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>
Lukas Fleischer cgit@cryptocrack.de
Sat, 06 Apr 2013 13:30:54 +0200
1 files changed,
2 insertions(+),
5 deletions(-)
jump to
M
html.c
→
html.c
@@ -6,6 +6,7 @@ * Licensed under GNU General Public License v2
* (see COPYING for full license text) */ +#include "cgit.h" #include "html.h" #include <unistd.h> #include <stdio.h>@@ -307,11 +308,7 @@
if (!txt_) return 0; - o = t = txt = strdup(txt_); - if (t == NULL) { - printf("Out of memory\n"); - exit(1); - } + o = t = txt = xstrdup(txt_); while ((c=*t) != '\0') { if (c == '=') { *t = '\0';