From e73a2194b3d257da996cbcceaa0fb376831ae62b Mon Sep 17 00:00:00 2001 From: Samanta Navarro Date: Mon, 15 May 2023 11:58:04 +0000 Subject: [PATCH] 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 --- libmisc/xgetXXbyYY.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libmisc/xgetXXbyYY.c b/libmisc/xgetXXbyYY.c index e1bf70f67..11e80e27c 100644 --- a/libmisc/xgetXXbyYY.c +++ b/libmisc/xgetXXbyYY.c @@ -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;