MT#59962 ModConference: do not leave allocated chan

If a channel has been allocated with
`ConferenceJoinChannel()` then remember to transfer
the ownership over it to the DSM sessions's
"garbage collector" which later takes care to
deallocate it.

Fixes:

    CID 542153: (#1 of 1): Resource leak (RESOURCE_LEAK)
    10. leaked_storage: Variable chan going out of scope leaks the storage it points to.

Change-Id: Icdc2c67cf2a349ec70fd83f1cf6a43ecfcf69547
master
Donat Zenichev 1 month ago
parent d2833bb513
commit e8941a5b24

@ -229,7 +229,15 @@ EXEC_ACTION_START(ConfRejoinAction) {
}
if (ConferenceJoinChannel(&chan, sess, sc_sess, channel_id, mode)) {
sc_sess->CLR_ERRNO;
/* save channel for later use */
AmArg c_arg;
c_arg.setBorrowedPointer(chan);
sc_sess->avar[CONF_AKEY_CHANNEL] = std::move(c_arg);
/* add to garbage collector */
sc_sess->transferOwnership(chan);
sc_sess->CLR_ERRNO;
} else {
sc_sess->SET_ERRNO(DSM_ERRNO_UNKNOWN_ARG);
}

Loading…
Cancel
Save