Module: kamailio
Branch: master
Commit: bce9cf97646153af6abcf9f43cbb72f2c734e490
URL:
https://github.com/kamailio/kamailio/commit/bce9cf97646153af6abcf9f43cbb72f…
Author: Chris Double <chris.double(a)double.co.nz>
Committer: Chris Double <chris.double(a)double.co.nz>
Date: 2015-09-24T10:58:52+12:00
janssonrpc-c: Fix double free if retry timer add fails
- Fix double free if schedule_retry fails when adding
request retry timer. timeout_cb called fail_request
which frees req after schedule_retry had already
done so.
---
Modified: modules/janssonrpc-c/janssonrpc_request.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bce9cf97646153af6abcf9f43cbb72f…
Patch:
https://github.com/kamailio/kamailio/commit/bce9cf97646153af6abcf9f43cbb72f…
---
diff --git a/modules/janssonrpc-c/janssonrpc_request.c
b/modules/janssonrpc-c/janssonrpc_request.c
index 39c7f31..f0117d9 100644
--- a/modules/janssonrpc-c/janssonrpc_request.c
+++ b/modules/janssonrpc-c/janssonrpc_request.c
@@ -253,8 +253,6 @@ int schedule_retry(jsonrpc_request_t* req)
new_req->ntries = req->ntries;
- free_request(req);
-
const struct timeval tv = ms_to_tv(time);
new_req->retry_ev = evtimer_new(global_ev_base, retry_cb, (void*)new_req);
@@ -264,6 +262,8 @@ int schedule_retry(jsonrpc_request_t* req)
goto error;
}
+ free_request(req);
+
return 0;
error:
ERR("schedule_retry failed.\n");