summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-07-23 18:10:19 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-07-23 18:10:19 +0000
commitb0aeeb1e786a8fa084a6c3c1d607daec06cf69f4 (patch)
treef8f5130d716b6e2cb16192ef55ebc52c21701070 /desktop
parent35cf89594d6016e63473d10032244becbb1874a5 (diff)
downloadnetsurf-b0aeeb1e786a8fa084a6c3c1d607daec06cf69f4.tar.gz
netsurf-b0aeeb1e786a8fa084a6c3c1d607daec06cf69f4.tar.bz2
Fix double frees on download failure
svn path=/trunk/netsurf/; revision=12621
Diffstat (limited to 'desktop')
-rw-r--r--desktop/download.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop/download.c b/desktop/download.c
index f90f3200e..71aa55e67 100644
--- a/desktop/download.c
+++ b/desktop/download.c
@@ -160,7 +160,9 @@ static nserror download_context_process_headers(download_context *ctx)
ctx->window = gui_download_window_create(ctx, ctx->parent);
if (ctx->window == NULL) {
free(ctx->filename);
+ ctx->filename = NULL;
lwc_string_unref(ctx->mime_type);
+ ctx->mime_type = NULL;
return NSERROR_NOMEM;
}
@@ -265,7 +267,8 @@ void download_context_destroy(download_context *ctx)
{
llcache_handle_release(ctx->llcache);
- lwc_string_unref(ctx->mime_type);
+ if (ctx->mime_type != NULL)
+ lwc_string_unref(ctx->mime_type);
free(ctx->filename);