diff options
author | David Vossel <dvossel@digium.com> | 2011-11-29 00:03:36 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2011-11-29 00:03:36 +0000 |
commit | d7dec4f14fc018d18ed480358f9a265b81b230b9 (patch) | |
tree | e3571e9d2d78beba6e44fb60640e18a5fc0b0ff3 /include/asterisk | |
parent | edaf970c3855d2eb805ad103bf95248d95a8e299 (diff) |
Merged revisions 346349 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10
........
r346349 | dvossel | 2011-11-28 18:00:11 -0600 (Mon, 28 Nov 2011) | 10 lines
Fixes memory leak in message API.
The ast_msg_get_var function did not properly decrement
the ref count of the var it retrieves. The way this is
implemented is a bit tricky, as we must decrement the var and then
return the var's value. As long as the documentation for the
function is followed, this will not result in a dangling pointer as
the ast_msg structure owns its own reference to the var while it
exists in the var container.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/message.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/asterisk/message.h b/include/asterisk/message.h index e52c4c406..d989563e5 100644 --- a/include/asterisk/message.h +++ b/include/asterisk/message.h @@ -173,7 +173,8 @@ int ast_msg_set_var(struct ast_msg *msg, const char *name, const char *value); /*! * \brief Get the specified variable on the message * \note The return value is valid only as long as the ast_message is valid. Hold a reference - * to the message if you plan on storing the return value. + * to the message if you plan on storing the return value. Do re-set the same + * message var name while holding a pointer to the result of this function. * * \return The value associated with variable "name". NULL if variable not found. */ |