From d5f1eb9c657d54bbe6db346a89694b6700a8dac3 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 10 Oct 2015 15:21:27 +0200 Subject: [PATCH] Closed memory leaks with errors in ecma119_image_new(). Coverity CID 12582. --- libisofs/ecma119.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libisofs/ecma119.c b/libisofs/ecma119.c index dfe71c7..9966ae0 100644 --- a/libisofs/ecma119.c +++ b/libisofs/ecma119.c @@ -2398,10 +2398,14 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img) sa_type = (system_area_options >> 2) & 0x3f; if (sa_type != 0 && sa_type != 3) for (i = 0; i < ISO_MAX_PARTITIONS; i++) - if (opts->appended_partitions[i] != NULL) - return ISO_NON_MBR_SYS_AREA; - if (sa_type != 0 && opts->prep_partition != NULL) - return ISO_NON_MBR_SYS_AREA; + if (opts->appended_partitions[i] != NULL) { + ret = ISO_NON_MBR_SYS_AREA; + goto target_cleanup; + } + if (sa_type != 0 && opts->prep_partition != NULL) { + ret = ISO_NON_MBR_SYS_AREA; + goto target_cleanup; + } target->system_area_data = NULL; if (system_area != NULL) {