From cd6801dc8746a79cfc116f3e73fc3afc5276a127 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 30 Mar 2017 12:14:38 +0200 Subject: lib: Fix invalid access in CDAP This fixes an invalid access to an object that was already freed. --- src/lib/cdap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/cdap.c') diff --git a/src/lib/cdap.c b/src/lib/cdap.c index 54a5b262..38806c23 100644 --- a/src/lib/cdap.c +++ b/src/lib/cdap.c @@ -703,6 +703,7 @@ int cdap_reply_wait(struct cdap * instance, { int ret; struct cdap_req * r; + invoke_id_t iid; if (instance == NULL || (data != NULL && len == NULL)) return -EINVAL; @@ -711,10 +712,12 @@ int cdap_reply_wait(struct cdap * instance, if (r == NULL) return -EINVAL; + iid = r->iid; + ret = cdap_req_wait(r); if (ret < 0) { cdap_sent_del(instance, r); - release_id(instance, r->iid); + release_id(instance, iid); return ret; } @@ -727,8 +730,8 @@ int cdap_reply_wait(struct cdap * instance, ret = r->response; - release_id(instance, r->iid); cdap_sent_del(instance, r); + release_id(instance, iid); return ret; } -- cgit v1.2.3