[Asterisk-code-review] sched: resolve a double deref on a sched del of an executing call back. (asterisk[16])

Joshua Colp asteriskteam at digium.com
Tue Dec 21 07:32:30 CST 2021


Attention is currently required from: Michael Bradeen.
Joshua Colp has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/17644 )

Change subject: sched: resolve a double deref on a sched del of an executing call back.
......................................................................


Patch Set 5: Code-Review-1

(2 comments)

File include/asterisk/sched.h:

https://gerrit.asterisk.org/c/asterisk/+/17644/comment/a652d84c_81d3382f 
PS5, Line 304:  * \brief Deletes a scheduled event provided the event is not running
I don't think this is descriptive enough, because the event may be running and then get deleted regardless. I'm not sure I have a suggestion otherwise though.


File tests/test_sched.c:

https://gerrit.asterisk.org/c/asterisk/+/17644/comment/1be8fb7e_2ac22b48 
PS5, Line 457: 	ao2_cleanup(obj);
This can still leak. At the start of the function we purposely put the reference count up 1 to prevent premature destruction in the failure case which results in it being '2' in the normal case. So in the correct case you need to decrement it twice to have it be destroyed. In the failure case, though, you can't just destroy it twice because you'll destroy it too many times.



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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Icfb16b3acbc29cf5b4cef74183f7531caaefe21d
Gerrit-Change-Number: 17644
Gerrit-PatchSet: 5
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-Attention: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Comment-Date: Tue, 21 Dec 2021 13:32:30 +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/20211221/462bdc11/attachment.html>


More information about the asterisk-code-review mailing list