From 9277021361a82617b595052ef3bdaf368981f1d8 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 17 Feb 2022 18:46:29 +0100 Subject: ipcpd: Check return value of enroll_pack Better to check the error code than the out parameter. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/common/enroll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ipcpd/common/enroll.c b/src/ipcpd/common/enroll.c index 090067d8..a369e016 100644 --- a/src/ipcpd/common/enroll.c +++ b/src/ipcpd/common/enroll.c @@ -187,7 +187,7 @@ static ssize_t enroll_pack(uint8_t ** buf) *buf = malloc(len); if (*buf == NULL) - return -1; + return -ENOMEM; enroll_msg__pack(&msg, *buf); @@ -236,7 +236,7 @@ static void * enroll_handle(void * o) enroll_msg__free_unpacked(msg, NULL); len = enroll_pack(&reply); - if (reply == NULL) { + if (len < 0) { log_err("Failed to pack enrollment message."); connmgr_dealloc(COMPID_ENROLL, &conn); continue; -- cgit v1.2.3