xgetXXbyYY: Handle DUP_FUNCTION failure

A failure of DUP_FUNCTION is already handled for non-reentrant
function wrapper. Perform the check for reentrant version as well.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
This commit is contained in:
Samanta Navarro 2023-05-15 11:58:04 +00:00 committed by Serge Hallyn
parent a80b792afc
commit e73a2194b3
1 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,12 @@
/* Build a result structure that can be freed by
* the shadow *_free functions. */
LOOKUP_TYPE *ret_result = DUP_FUNCTION(result);
if (NULL == result) {
fprintf (log_get_logfd(),
_("%s: out of memory\n"),
"x" STRINGIZE(FUNCTION_NAME));
exit (13);
}
free(buffer);
free(result);
return ret_result;