]> git.ipfire.org Git - thirdparty/glibc.git/commit
nis: Fix leak on realloc failure in nis_getnames [BZ #28150]
authorRobbie Harwood <rharwood@redhat.com>
Wed, 28 Jul 2021 18:23:32 +0000 (14:23 -0400)
committerCarlos O'Donell <carlos@redhat.com>
Mon, 2 Aug 2021 15:14:20 +0000 (11:14 -0400)
commit60698263122b7c54ded3f70a466176e17a529480
tree8fa13c7d0b7bff86390915beb2ed4ab66fd1f89f
parentdb737c79c694d0cb65dbc40696c8765b4299310c
nis: Fix leak on realloc failure in nis_getnames [BZ #28150]

If pos >= count but realloc fails, tmp will not have been placed in
getnames[pos] yet, and so will not be freed in free_null.  Detected
by Coverity.

Also remove misleading comment from nis_getnames(), since it actually
did properly release getnames when out of memory.

Tested-by: Carlos O'Donell <carlos@redhat.com>
nis/nis_subr.c