From b76283f3d52985abd24081bcbb9196ec440e10af Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 28 Jan 2007 23:53:20 +0000 Subject: Handle strdup failure svn path=/trunk/netsurf/; revision=3153 --- content/urldb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/content/urldb.c b/content/urldb.c index cc6d370a3..9c3214823 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -2587,6 +2587,9 @@ bool urldb_set_cookie(const char *header, const char *url, /* strip fragment */ urlt = strdup(url); + if (!urlt) + return false; + scheme = strchr(urlt, '#'); if (scheme) *scheme = '\0'; @@ -2762,7 +2765,8 @@ error: * \param cookie Pointer to cookie string (updated on exit) * \return Pointer to cookie structure (on heap, caller frees) or NULL */ -struct cookie_internal_data *urldb_parse_cookie(const char *url, const char **cookie) +struct cookie_internal_data *urldb_parse_cookie(const char *url, + const char **cookie) { struct cookie_internal_data *c; const char *cur; @@ -3267,7 +3271,8 @@ void urldb_load_cookies(const char *filename) assert(p <= end); /* Now create cookie */ - struct cookie_internal_data *c = malloc(sizeof(struct cookie_internal_data)); + struct cookie_internal_data *c = + malloc(sizeof(struct cookie_internal_data)); if (!c) break; -- cgit v1.2.3