[Asterisk-code-review] res smdi.c: Fix module ref counting and inverted test. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Wed Oct 3 11:08:03 CDT 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/10382 )

Change subject: res_smdi.c: Fix module ref counting and inverted test.
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.asterisk.org/#/c/10382/2/res/res_smdi.c
File res/res_smdi.c:

https://gerrit.asterisk.org/#/c/10382/2/res/res_smdi.c@249
PS2, Line 249: 		ast_module_unref(ast_module_info->self);
> I think the interface/thread should not hold a reference to the module, we should just use ast_modul […]
I had originally removed these module ref/unref's because I thought the iface objects were entirely contained within this module.  Then I found ast_smdi_interface_find() returning refs to external modules.

The only way to be sure that module refs are kept for externally held iface objects would be to pass a wrapper object back from ast_smdi_interface_find() and make the API use the wrapper objects instead.  The wrapper object would track these externally held iface refs to control the module refs.

It looks like chan_dahdi.c makes an attempt to cleanup these iface refs.  However, app_voicemail.c never releases the iface ref it gets.  It would never be safe to use ast_module_shutdown_ref() in this case because the iface thread is never shutdown.

I feel the same way about this module.  The module is old, poorly written, and supports old technology that appears to no longer be used with Asterisk.



-- 
To view, visit https://gerrit.asterisk.org/10382
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic288db51b58e395d6a2fc3847f77176c16988784
Gerrit-Change-Number: 10382
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 03 Oct 2018 16:08:03 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181003/3dafd4e6/attachment.html>


More information about the asterisk-code-review mailing list