Skip to content

Commit 605392d

Browse files
committed
aaa_diameter: fix reply cJSON ownership in dm_send_request() paths
_dm_get_message_response() detached cond->rpl.json into a temporary reply object before wrapper cleanup ran. Now, cleanup frees only cond->rpl.json, so the SHM-backed cJSON reply tree leaked.
1 parent bf9f69f commit 605392d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

modules/aaa_diameter/dm_impl.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,13 +2058,14 @@ static int _dm_get_message_reply(struct dm_cond *cond, diameter_reply *rpl)
20582058

20592059
int _dm_get_message_response(struct dm_cond *cond, char **rpl_avps)
20602060
{
2061-
cJSON *obj;
2062-
diameter_reply rpl;
2063-
int rc = _dm_get_message_reply(cond, &rpl);
2061+
int rc;
2062+
2063+
LM_DBG("reply received, Result-Code: %d (%s)\n", cond->rpl.rc,
2064+
cond->rpl.is_error ? "FAILURE" : "SUCCESS");
2065+
rc = (cond->rpl.is_error ? -1 : 0);
20642066

20652067
if (rpl_avps) {
2066-
obj = dm_api_get_reply(&rpl);
2067-
*rpl_avps = cJSON_PrintUnformatted(obj);
2068+
*rpl_avps = cJSON_PrintUnformatted(cond->rpl.json);
20682069
LM_DBG("AVPs: %s\n", *rpl_avps);
20692070
}
20702071
return rc;

0 commit comments

Comments
 (0)