diff mbox series

[2/5] libsepol: check correct pointer for oom

Message ID 20220408131054.7957-2-cgzones@googlemail.com (mailing list archive)
State Accepted
Commit 68a29c3aee60
Headers show
Series [1/5] libsepol/cil: declare file local function pointer static | expand

Commit Message

Christian Göttsche April 8, 2022, 1:10 p.m. UTC
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;
                                                    ^ ~~~~~~~~~

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libsepol/src/services.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libsepol/src/services.c b/libsepol/src/services.c
index 29723729..b8fb2704 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;
 					}