summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-12-28 16:02:57 +0100
committerdimitri staessens <[email protected]>2016-12-28 16:02:57 +0100
commite8d6e91203b0521572b0ae32202e69944dde8f04 (patch)
tree5c80c01627e76086aa48569c32a0c52a37e21a53 /src/ipcpd/normal
parent9766166aa944fc6d8754f1b2c5262d7044690c50 (diff)
downloadouroboros-e8d6e91203b0521572b0ae32202e69944dde8f04.tar.gz
ouroboros-e8d6e91203b0521572b0ae32202e69944dde8f04.zip
ipcpd: Fix memleak in ribmgr
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/ribmgr.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c
index d2ba8deb..3b4a5784 100644
--- a/src/ipcpd/normal/ribmgr.c
+++ b/src/ipcpd/normal/ribmgr.c
@@ -971,18 +971,23 @@ static void * cdap_req_handler(void * o)
if (opcode == CDAP_START) {
if (ribmgr_cdap_start(instance, key, name))
LOG_WARN("CDAP start failed.");
+ free(name);
continue;
}
else if (opcode == CDAP_STOP) {
if (ribmgr_cdap_stop(instance, key, name))
LOG_WARN("CDAP stop failed.");
+ free(name);
continue;
}
+ assert(len > 0);
+
msg = ro_msg__unpack(NULL, len, data);
if (msg == NULL) {
cdap_reply_send(instance, key, -1, NULL, 0);
LOG_WARN("Failed to unpack RO message");
+ free(data);
continue;
}
@@ -996,6 +1001,7 @@ static void * cdap_req_handler(void * o)
ro_msg__free_unpacked(msg, NULL);
cdap_reply_send(instance, key, 0, NULL, 0);
LOG_DBG("Already received this RO.");
+ free(name);
continue;
}
}
@@ -1005,6 +1011,7 @@ static void * cdap_req_handler(void * o)
if (ribmgr_cdap_create(instance, key, name, msg)) {
LOG_WARN("CDAP create failed.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
} else if (opcode == CDAP_WRITE) {
@@ -1012,24 +1019,28 @@ static void * cdap_req_handler(void * o)
msg, flags)) {
LOG_WARN("CDAP write failed.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
} else if (opcode == CDAP_DELETE) {
if (ribmgr_cdap_delete(instance, key, name)) {
LOG_WARN("CDAP delete failed.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
} else {
LOG_INFO("Unsupported opcode received.");
ro_msg__free_unpacked(msg, NULL);
cdap_reply_send(instance, key, -1, NULL, 0);
+ free(name);
continue;
}
if (ro_id_create(name, msg)) {
LOG_WARN("Failed to create RO id.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
@@ -1050,6 +1061,7 @@ static void * cdap_req_handler(void * o)
pthread_rwlock_unlock(&rib.flows_lock);
}
+ free(name);
ro_msg__free_unpacked(msg, NULL);
}