Blame SOURCES/0018-Try-even-harder-to-convince-coverity-that-get_file-i.patch

5e6fc3
From 576b89de7d1a49d64efab9d494eeea5a296bdccd Mon Sep 17 00:00:00 2001
5e6fc3
From: Peter Jones <pjones@redhat.com>
5e6fc3
Date: Thu, 21 Jun 2018 12:23:20 -0400
5e6fc3
Subject: [PATCH 18/39] Try even harder to convince coverity that get_file
5e6fc3
 isn't leaking memory...
5e6fc3
5e6fc3
Signed-off-by: Peter Jones <pjones@redhat.com>
5e6fc3
---
5e6fc3
 src/util.h | 7 +++++++
5e6fc3
 1 file changed, 7 insertions(+)
5e6fc3
5e6fc3
diff --git a/src/util.h b/src/util.h
5e6fc3
index ef85a4c277e..441ced84fcf 100644
5e6fc3
--- a/src/util.h
5e6fc3
+++ b/src/util.h
5e6fc3
@@ -332,6 +332,13 @@ get_file(uint8_t **result, const char * const fmt, ...)
5e6fc3
         errno = error;
5e6fc3
 
5e6fc3
         if (rc < 0 || bufsize < 1) {
5e6fc3
+                /*
5e6fc3
+                 * I don't think this can happen, but I can't convince
5e6fc3
+                 * cov-scan
5e6fc3
+                 */
5e6fc3
+                if (buf)
5e6fc3
+                        free(buf);
5e6fc3
+                *result = NULL;
5e6fc3
                 efi_error("could not read file \"%s\"", path);
5e6fc3
                 return -1;
5e6fc3
         }
5e6fc3
-- 
5e6fc3
2.17.1
5e6fc3