From 7bdc4c96f5a2a983347ae9d8953cfe342b387903 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 11 Oct 2015 15:18:03 +0200 Subject: [PATCH] Avoided to close unopened file pointer in case of error. Coverity CID 12546. --- libisofs/ecma119.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libisofs/ecma119.c b/libisofs/ecma119.c index d86ea6d..ad05cce 100644 --- a/libisofs/ecma119.c +++ b/libisofs/ecma119.c @@ -2037,7 +2037,8 @@ int iso_write_partition_file(Ecma119Image *target, char *path, } ret = iso_write(target, buf, BLOCK_SIZE); if (ret < 0) { - fclose(fp); + if (fp != NULL) + fclose(fp); goto ex; } }