From 68a29c3aee60a6dd4e0d435fc10adb0f2cc1c0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 8 Apr 2022 15:10:51 +0200 Subject: [PATCH] libsepol: check correct pointer for oom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check the actual pointer which memory was assigned to, not its parent array pointer. services.c:810:14: warning: Assigned value is garbage or undefined [core.uninitialized.Assign] **r_buf = **new_buf; ^ ~~~~~~~~~ Acked-by: James Carter Signed-off-by: Christian Göttsche --- libsepol/src/services.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsepol/src/services.c b/libsepol/src/services.c index 47e564df..d7510e9d 100644 --- a/libsepol/src/services.c +++ b/libsepol/src/services.c @@ -803,7 +803,7 @@ mls_ops: if (len < 0 || len >= reason_buf_len - reason_buf_used) { new_buf_len = reason_buf_len + REASON_BUF_SIZE; *new_buf = realloc(*r_buf, new_buf_len); - if (!new_buf) { + if (!*new_buf) { ERR(NULL, "failed to realloc reason buffer"); goto out1; }