Skip to content

Commit 4670382

Browse files
committed
fix "src/dmidecodemodule.c:828:9 warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where non-null expected"
Fix the following error found by covscan, Error: GCC_ANALYZER_WARNING (CWE-688): [#def20] python-dmidecode-3.12.2/src/dmidecodemodule.c:828:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where non-null expected /usr/include/python3.9/Python.h:30: included_from: Included from here. python-dmidecode-3.12.2/src/dmidecodemodule.c:42: included_from: Included from here. /usr/include/string.h:61:14: note: argument 1 of memset must be non-null
1 parent 516a9bd commit 4670382

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/dmidecodemodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,9 @@ initdmidecodemod(void)
825825
xmlXPathInit();
826826

827827
opt = (options *) malloc(sizeof(options)+2);
828+
if (opt == NULL)
829+
MODINITERROR;
830+
828831
memset(opt, 0, sizeof(options)+2);
829832
init(opt);
830833
#ifdef IS_PY3K

0 commit comments

Comments
 (0)