[Home]

Summary:ASTERISK-23128: res_ari: Memory leak on response headers and some JSON response messages
Reporter:Joshua C. Colp (jcolp)Labels:
Date Opened:2014-01-09 06:09:44.000-0600Date Closed:2014-01-12 16:24:07.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_ari
Versions:12.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:There are currently a few leaks in the res_ari area of Asterisk 12:

1. A headers field on the response structure of type ast_str is allocated in ast_ari_callback which contains the HTTP response headers to send. This is never freed. I see no reason to have another response_headers ast_str as well, so response.headers can just be passed to ast_http_send directly.

2. A lot of ast_ari_response_ok usage assumes that it steals the JSON reference when in reality it increments it itself. This is counter to the documentation and is causing JSON message responses to not get freed. Either the function needs to do as documented and steal, or it needs to be documented that it bumps it itself and an audit done for callers.
Comments:By: Joshua C. Colp (jcolp) 2014-01-09 17:35:14.938-0600

A code review is now up at: https://reviewboard.asterisk.org/r/3119/ which fixes the memory leaks.