From: Eric Biggers Date: Sat, 19 May 2012 19:01:08 +0000 (-0500) Subject: Fix deference NULL pointer on join error X-Git-Tag: v0.7.1~10 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=393e8e46f87e6119f85b7fc9910624f567c5a34b Fix deference NULL pointer on join error --- diff --git a/src/join.c b/src/join.c index b804f8f8..1326804b 100644 --- a/src/join.c +++ b/src/join.c @@ -151,7 +151,7 @@ WIMLIBAPI int wimlib_join(const char **swm_names, int num_swms, } } if (w->hdr.total_parts != num_swms) { - ERROR("`%s' (part %d) says there are %d total parts,\n" + ERROR("`%s' (part %d) says there are %d total parts, " "but %d parts were specified!\n", swm_names[i], w->hdr.part_number, w->hdr.total_parts, num_swms); @@ -195,8 +195,10 @@ err: for (i = 0; i < num_swms; i++) { /* out_fp is the same in all the swms and joined_wim; only close * it one time, when freeing joined_wim. */ - swms[i]->out_fp = NULL; - wimlib_free(swms[i]); + if (swms[i]) { + swms[i]->out_fp = NULL; + wimlib_free(swms[i]); + } } wimlib_free(joined_wim); return ret;