Use the xstrdup() wrapper which already bails out if strdup() returns a NULL pointer.
Signed-off-by: Lukas Fleischer <[email protected]> --- Note that this revision is based on John's patch ("Always #include corresponding .h in .c files") which gets a +1 from me. html.c | 7 ++----- 1 file 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 @@ * (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'; -- 1.8.2.674.g2c8b7bf _______________________________________________ cgit mailing list [email protected] http://hjemli.net/mailman/listinfo/cgit
