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 19:08:53 UTC 2019


laforge has submitted this change and it was merged. ( 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(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



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-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190721/6e180dfd/attachment.html>


More information about the gerrit-log mailing list