]> granicus.if.org Git - cgit/commitdiff
html.c: Replace strdup() with xstrdup()
authorLukas Fleischer <cgit@cryptocrack.de>
Sat, 6 Apr 2013 11:30:54 +0000 (13:30 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 8 Apr 2013 13:45:34 +0000 (15:45 +0200)
Use the xstrdup() wrapper which already bails out if strdup() returns a
NULL pointer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
html.c

diff --git a/html.c b/html.c
index 1104f97faeec025f19ecf0a27f6b00a3af8b0de1..8c45ba69daa1482456172281850b29689152581a 100644 (file)
--- a/html.c
+++ b/html.c
@@ -6,6 +6,7 @@
  *   (see COPYING for full license text)
  */
 
+#include "cgit.h"
 #include "html.h"
 #include <unistd.h>
 #include <stdio.h>
@@ -307,11 +308,7 @@ int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const
        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';