Change in ...osmo-remsim[master]: server: rest_api: Fix memory leak in slotmap post

laforge gerrit-no-reply at lists.osmocom.org
Sun Jul 21 18:43:23 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/14884


Change subject: server: rest_api: Fix memory leak in slotmap post
......................................................................

server: rest_api: Fix memory leak in slotmap post

We need to decrement the refcount on the json_req object.

Change-Id: I1a550eff76e6a72013ab47ef8f240a72d7a7d9cb
---
M src/server/rest_api.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/84/14884/1

diff --git a/src/server/rest_api.c b/src/server/rest_api.c
index 969f672..abd46b9 100644
--- a/src/server/rest_api.c
+++ b/src/server/rest_api.c
@@ -309,7 +309,7 @@
 	struct slot_mapping slotmap, *map;
 	struct rspro_client_conn *conn;
 	json_error_t json_err;
-	json_t *json_req;
+	json_t *json_req = NULL;
 	int rc;
 
 	json_req = ulfius_get_json_body_request(req, &json_err);
@@ -341,10 +341,12 @@
 	pthread_rwlock_unlock(&srv->rwlock);
 
 
+	json_decref(json_req);
 	ulfius_set_empty_body_response(resp, 201);
 
 	return U_CALLBACK_COMPLETE;
 err:
+	json_decref(json_req);
 	ulfius_set_empty_body_response(resp, 400);
 	return U_CALLBACK_COMPLETE;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/14884
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I1a550eff76e6a72013ab47ef8f240a72d7a7d9cb
Gerrit-Change-Number: 14884
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190721/b20c26c6/attachment.html>


More information about the gerrit-log mailing list