Add a forgotten fclose() call
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 9 Mar 2019 20:22:34 +0000 (21:22 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 9 Mar 2019 20:22:34 +0000 (21:22 +0100)
Fixes CID 1443021.

src/procmime.c

index 6c682a6..6bcf5bb 100644 (file)
@@ -2692,7 +2692,12 @@ void *procmime_get_part_as_string(MimeInfo *mimeinfo,
        length = mimeinfo->length;
 
        data = g_malloc(null_terminate ? length + 1 : length);
-       cm_return_val_if_fail(data != NULL, NULL);
+       if (data == NULL) {
+               g_warning("Could not allocate %d bytes for procmime_get_part_as_string.\n",
+                               (null_terminate ? length + 1 : length));
+               claws_fclose(infp);
+               return NULL;
+       }
 
        readlength = claws_fread(data, length, 1, infp);
        if (readlength <= 0) {