From 82e2fc57d7ded7e917ae399ca99fa8953f137b2d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 1 May 2013 22:15:24 +0100 Subject: free memory on error path --- content/llcache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'content') diff --git a/content/llcache.c b/content/llcache.c index 8996acadd..171ae15fc 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -539,8 +539,11 @@ static nserror llcache_fetch_parse_header(llcache_object *object, /* extract ETag header */ free(object->cache.etag); object->cache.etag = strdup(*value); - if (object->cache.etag == NULL) + if (object->cache.etag == NULL) { + free(*name); + free(*value); return NSERROR_NOMEM; + } } else if (14 < len && strcasecmp(*name, "Last-Modified") == 0) { /* extract Last-Modified header */ object->cache.last_modified = curl_getdate(*value, NULL); @@ -613,8 +616,9 @@ static nserror llcache_fetch_process_header(llcache_object *object, } error = llcache_fetch_parse_header(object, data, len, &name, &value); - if (error != NSERROR_OK) + if (error != NSERROR_OK) { return error; + } /* Append header data to the object's headers array */ temp = realloc(object->headers, (object->num_headers + 1) * -- cgit v1.2.3