summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-02-17 18:46:29 +0100
committerSander Vrijders <sander@ouroboros.rocks>2022-02-18 08:43:14 +0100
commit9277021361a82617b595052ef3bdaf368981f1d8 (patch)
tree6e127fb665fa10c47b959c56ef9d23814d1df482
parentf49eaaf690afb4f5b9fc56e4ca35e04277c3f012 (diff)
downloadouroboros-9277021361a82617b595052ef3bdaf368981f1d8.tar.gz
ouroboros-9277021361a82617b595052ef3bdaf368981f1d8.zip
ipcpd: Check return value of enroll_pack
Better to check the error code than the out parameter. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/ipcpd/common/enroll.c4
1 files changed, 2 insertions, 2 deletions
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;