From 393e8e46f87e6119f85b7fc9910624f567c5a34b Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 19 May 2012 14:01:08 -0500 Subject: [PATCH 1/1] Fix deference NULL pointer on join error --- src/join.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; -- 2.43.0