diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-07-28 16:18:02 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-07-28 16:18:02 -0700 |
commit | ed190ca257c808b5d76babf01a5dd57c7d749c9d (patch) | |
tree | 119e44a53c8ec081ca6a1f021ac156042fc04adf | |
parent | 75a78342999f5c98ba5e0d154a1c506497daac5d (diff) |
ClearFontStuff: avoid NULL pointer dereference
Clears warning from cppcheck:
psgeom.c:400:5: warning: Either the condition 'stuff' is redundant or there
is possible null pointer dereference: stuff. [nullPointerRedundantCheck]
bzero(stuff, sizeof(FontStuff));
^
psgeom.c:398:9: note: Assuming that condition 'stuff' is not redundant
if (stuff && stuff->foundry)
^
psgeom.c:400:5: note: Null pointer dereference
bzero(stuff, sizeof(FontStuff));
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/app/xkbprint/-/merge_requests/6>
-rw-r--r-- | psgeom.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -395,9 +395,10 @@ typedef struct { static void ClearFontStuff(FontStuff *stuff) { - if (stuff && stuff->foundry) + if (stuff) { free(stuff->foundry); - bzero(stuff, sizeof(FontStuff)); + bzero(stuff, sizeof(FontStuff)); + } return; } |