[Home]

Summary:ASTERISK-19665: Coverity Report: Fix issues for error type RESOURCE_LEAK
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2012-04-06 14:15:31Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:General
Versions:1.8.6.0 13.18.4 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) core_RESOURCE_LEAK.txt
( 1) extended_RESOURCE_LEAK.txt
Description:Resolve findings from Coverity Static Analysis Report for type RESOURCE_LEAK.

Note that the findings are contained in the files attached to this issue, organized by module support level.
Comments:By: Matt Jordan (mjordan) 2012-04-06 15:36:30.702-0500

Core: ast_expr2.y, line 533,536: fixed by Russell Bryant
Core: app_page.c, line 205, 300: fixed by Russell Bryant
Extended: app_jack: fixed by Russell Bryant
Deprecated: app_meetme: Finding #24 - fixed by Matt Jordan


By: Matt Jordan (mjordan) 2012-04-06 17:03:20.810-0500

Fixed res_calendar_ews memory leak FINDING #190

Note that any memory leak reference to ao2_callback with OBJ_NODATA (or some bit mask containing it) should be ignored.  Coverity (through no real fault of its own) cannot determine that the ao2_callback method doesn't bump the ref count or return an allocated object on any code path when that flag is specified.

This negates Findings 15 - 23, 25, 27.

By: Matt Jordan (mjordan) 2012-05-10 13:57:27.415-0500

Core issues:

Finding #0: Not an issue - Coverity cannot determine that the ao2_callback method won't allocate memory
Finding #1-2: Fixed
Finding #3: Fixed
Finding #4: Sort of surprised Coverity flagged this one.  Along the nominal path that it flagged as being a problem, ast_trans_pvt *head is returned from the method, which points to the first object that was allocated via newpvt.  This forms a linked list along all ast_trans_pvt objects allocated.  The methods that call ast_translator_build_path alll call ast_translator_free_path; hence, there is no memory leak.
Finding #5-6: code generated for AEL, extended support


By: Matt Jordan (mjordan) 2012-05-11 11:47:52.189-0500

Core issues:
Finding #7: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #8: In Berkley DB source, won't fix (not used past 1.8)
Finding #9: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #10: already resolved
Finding #11-13: already resolved
Finding #14: Not an issue.  If new_follower is allocated in find_realtime, the realtime flag will be set.  app_exec, before it returns, checks this flag and deallocates f if the flag is set.
Finding #15: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #16-23: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #24: already resolved
Finding #25: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #26: Fixed
Finding #27: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #28-29: Fixed
Finding #30: Fixed
Finding #31: Not an issue.  If q is assigned to a ref counted object, it is de-ref'd prior to being reassigned by find_queue_by_name_rt.
Finding #32: If the list_name never matches the rule_list names, then the rule would be leaked.  Fixed.
Finding #33-36: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #37: Fixed
Finding #38: Technically, you should never get in a situation where silence is greater then 0, but the previous read format is 0.  So you should always free sildet in the out: label.  That being said, since sildet is initially NULL, we can always check to see if its non-NULL and free it accordingly.  Moved it out simply to bypass Coverity.
Finding #39: If obj is created, it assumes responsibility for the reference to class returned by the ao2_callback.  This code is not trivial to parse, but it should be that if obj is placed within an container, it owns class; if it is not placed in the container, class is deref'd appropriately along the various code paths.
Finding #40: Fixed
Finding #41-42: Fixed
Finding #43-44: OBJ_NODATA is passed to the ao2_callback, implying that the container will not be allocated.  Not an issue.
Finding #45-46: Fixed
Finding #47: Fixed
Finding #48: chan_gtalk is extended support; skipping
Finding #49:

By: Matt Jordan (mjordan) 2012-05-14 16:50:43.799-0500

More core issues:
Finding #49-50: the ao2_callback does not use OBJ_MULTIPLE, so the internal container will never be allocated.  No memory leak.
Finding #51:  Fixed
Finding #52-53: the ao2_callback does not use OBJ_MULTIPLE, so the internal container will never be allocated.  No memory leak.
Finding #53-55: the ao2_callback includes OBJ_NODATA, so the internal container will never be allocated.
Finding #56: the ao2_callback does not use OBJ_MULTIPLE, so the internal container will never be allocated.  No memory leak.
Finding #57: Fixed
Finding #58-59: chan_mgcp is extended; skipping
Finding #60: chan_phone is extended; skipping
Finding #61: Fixed
Finding #62: Previously fixed
Finding #63: Not an issue.  The multicontainer is never allocated as OBJ_MULTIPLE is not set, and the returned object is deref'd on all code paths.
Finding #64-66: the ao2_callback includes OBJ_NODATA, so the internal container will never be allocated.
Finding #67: Fixed
Finding #68: Fixed
Finding #69-73: OBJ_NODATA callback
Finding #74: chan_skinny is extended support; skipping
Finding #75: chan_unistim is extended support; skipping
Finding #76: chan_usbradio is extended support; skipping
Finding #77-78: Fixed
Finding #79: Previously fixed
Finding #80: Fixed
Finding #81: Fixed
Finding #82-83: Fixed
Finding #84: Previously fixed
Finding #85-86: Fixed
Finding #87: Not an issue, callback with OBJ_NODATA
Finding #88: Fixed
Finding #89: Not an issue, callback with OBJ_NODATA
Finding #90: Fixed
Finding #91-103: Not an issue, callback issued with either OBJ_NODATA or without OBJ_MULTIPLE
Finding #104: ast_channel_callback called with OBJ_NODATA
Finding #105:

By: Matt Jordan (mjordan) 2012-05-15 17:57:55.848-0500

Finding #105: Fixed (some paths already fixed)
Finding #106-107: Fixed
Finding #108: Fixed
Finding #109: OBJ_NODATA callback
Finding #110: Fixed
Finding #111-112: Fixed
Finding #113-114: This does not appear to be an issue
Finding #115-117: OBJ_NODATA callbacks
Finding #118: Could no longer find this code - Richard's parking patch pretty much removed it all
Finding #119-124: OBJ_NODATA callback
Finding #125: Fixed
Finding #126-127: Fixed
Finding #128: Fixed in netsock2 code
Finding #129: Fixed
Finding #130-160 :mxml will, in its allocation functions, add new elements to the parent nodes if they exist.  Any method that passes in a parent node does not cause a memory leak so long as that parent node is cleaned up appropriately.
Finding #161-163: ael is in extended support; not fixing
Finding #164: pbx_lua is in extended support; not fixing
Finding #165: pbx_realtime is in extended support - OBJ_NODATA, not an issue
Finding #166-174: ael is in extended support; not fixing
Finding #175-179: OBJ_NODATA callback, not an issue
Finding #176-182: Fixed
Finding #183: Fixed
Finding #184-186: OBJ_NODATA callback, not an issue
Finding #187: Fixed
Finding #188: OBJ_NODATA callback, not an issue
Finding #189: Fixed
Finding #190: Previously fixed
Finding #191-192: OBJ_NODATA callback, not an issue
Finding #193: Fixed
Finding #194: Fixed
Finding #195-196: OBJ_NODATA callback, not an issue
Finding #197-200: res_config_ldap is extended support, not fixing
Finding #201: res_config_pgsql is extended support, not fixing
Finding #202: Fixed
Finding #203: Fixed
Finding #204-208: OBJ_NODATA callback, not an issue
Finding #209-210: res_phoneprov is extended support, not fixing
Finding #211: Fixed
Finding #212-215: res_smdi is extended, not fixing
Finding #216: Fixed
Finding #217-218: OBJ_NODATA callback, not an issue