Skip to content

stubs/atom.c: Fix memory leak in __libxfont_internal__MakeAtom

Reported by a static analysis tool:

 9. libXfont2-2.0.6/src/stubs/atom.c:179:5:
    alloc_fn: Storage is returned from allocation function "malloc".
10. libXfont2-2.0.6/src/stubs/atom.c:179:5:
    var_assign: Assigning: "a" = storage returned from
    "malloc(24UL + len + 1UL)".
16. libXfont2-2.0.6/src/stubs/atom.c:194:6:
    leaked_storage: Variable "a" going out of scope leaks the
    storage it points to.
#   192|  if ((ResizeHashTable() == FALSE) &&
#   193|     ((hashTable == NULL) || (hashUsed == hashSize)))
#   194|-> 	 return None;
#   195|  h = hash & hashMask;
#   196|  if (hashTable[h]) {

Fixes: 78085e6b ("stubs/atom.c: check for ResizeHashTable failure")

Merge request reports