]> git.ipfire.org Git - thirdparty/suricata.git/commit
mime: address scan-build warnings
authorVictor Julien <vjulien@oisf.net>
Fri, 21 Apr 2023 12:12:36 +0000 (14:12 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 25 Apr 2023 09:36:37 +0000 (11:36 +0200)
commitaaee63bab1cf9d4de2009c6d50a5d60bd110317c
tree0ca1de90962adaa947bec255a274a82f3ddf5089
parentb802a6241fe3823ec99f387ebd2a3fa71e61498b
mime: address scan-build warnings

util-decode-mime.c:189:31: warning: Use of memory after it is freed [unix.Malloc]
            lastSibling->next = entity->child;
            ~~~~~~~~~~~~~~~~~ ^
util-decode-mime.c:827:24: warning: Potential leak of memory pointed to by 'val' [unix.Malloc]
        state->hname = NULL;
                       ^~~~
/usr/lib/llvm-16/lib/clang/16/include/stddef.h:89:24: note: expanded from macro 'NULL'
 #  define NULL ((void*)0)
                       ^
2 warnings generated.

Improve error handling and add assert to avoid these warnings.

Bug: #3147.
(cherry picked from commit 9224b3435b94e848cc677103573439e505e808b3)
src/util-decode-mime.c