Blame SOURCES/0008-fix-src-dmidecodemodule.c-828-9-warning-Wanalyzer-po.patch

b52212
From 8ae11992db2a5b338c4d28e44174f57c37f020e8 Mon Sep 17 00:00:00 2001
b52212
From: Coiby Xu <coiby.xu@gmail.com>
b52212
Date: Tue, 15 Jun 2021 11:09:33 +0800
b52212
Subject: [PATCH 8/8] fix "src/dmidecodemodule.c:828:9
b52212
 warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where
b52212
 non-null expected"
b52212
b52212
Fix the following error found by covscan,
b52212
b52212
    Error: GCC_ANALYZER_WARNING (CWE-688): [#def20]
b52212
    python-dmidecode-3.12.2/src/dmidecodemodule.c:828:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where non-null expected
b52212
    /usr/include/python3.9/Python.h:30: included_from: Included from here.
b52212
    python-dmidecode-3.12.2/src/dmidecodemodule.c:42: included_from: Included from here.
b52212
    /usr/include/string.h:61:14: note: argument 1 of memset must be non-null
b52212
b52212
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
b52212
---
b52212
 src/dmidecodemodule.c | 3 +++
b52212
 1 file changed, 3 insertions(+)
b52212
b52212
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c
b52212
index b73811e..44ef7aa 100644
b52212
--- a/src/dmidecodemodule.c
b52212
+++ b/src/dmidecodemodule.c
b52212
@@ -825,6 +825,9 @@ initdmidecodemod(void)
b52212
         xmlXPathInit();
b52212
 
b52212
         opt = (options *) malloc(sizeof(options)+2);
b52212
+        if (opt == NULL)
b52212
+                MODINITERROR;
b52212
+
b52212
         memset(opt, 0, sizeof(options)+2);
b52212
         init(opt);
b52212
 #ifdef IS_PY3K
b52212
-- 
b52212
2.31.1
b52212