[Asterisk-code-review] stasis: Fix crash at shutdown. (...asterisk[13])

Kevin Harwell asteriskteam at digium.com
Tue Apr 23 16:56:26 CDT 2019


Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/11304 )

Change subject: stasis: Fix crash at shutdown.
......................................................................


Patch Set 2: Code-Review-1

(4 comments)

https://gerrit.asterisk.org/#/c/11304/2/main/stasis.c 
File main/stasis.c:

https://gerrit.asterisk.org/#/c/11304/2/main/stasis.c@412 
PS2, Line 412: 	if (topic->statistics && topic_stats) {
Separate these checks since the associated tasks to each check are not dependent on the other.

For instance, as it is now there is a ref leak on topic->statistics if it is not NULL, but topic_stats is.


https://gerrit.asterisk.org/#/c/11304/2/main/stasis.c@587 
PS2, Line 587: 	if (sub->statistics && subscription_stats) {
             : 		ao2_unlink(subscription_stats, sub->statistics);
             : 		ao2_ref(sub->statistics, -1);
             : 	}
Same thing here as far as separating the checks. sub->statistics can potentially be ref leaked.


https://gerrit.asterisk.org/#/c/11304/2/main/stasis.c@2281 
PS2, Line 2281: 	RAII_VAR(struct ao2_container *, subscription_stats, ao2_global_obj_ref(subscription_statistics), ao2_cleanup);
Drop the RAII_VAR and retrieve it just before the find below and unref it just after.


https://gerrit.asterisk.org/#/c/11304/2/main/stasis.c@2467 
PS2, Line 2467: 	RAII_VAR(struct ao2_container *, topic_stats, ao2_global_obj_ref(topic_statistics), ao2_cleanup);
No real need for a RAII_VAR here too.



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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: Ie7d5e907fcfcb4d65bd36d5e4eb923126fde8d33
Gerrit-Change-Number: 11304
Gerrit-PatchSet: 2
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Comment-Date: Tue, 23 Apr 2019 21:56:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190423/985a0f9d/attachment-0001.html>


More information about the asterisk-code-review mailing list