diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 16:58:28 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 16:58:28 +0000 |
commit | 9f9c200a46b80e258ea89f0926c3c1163f82fe60 (patch) | |
tree | e52da8bd1e1dc4b33664910a8e8d22def45b0668 /include/asterisk/linkedlists.h | |
parent | d57c5f9d0a22828a0098808fb1f4ec6994f0be38 (diff) |
Merged revisions 67716 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r67716 | russell | 2007-06-06 11:55:59 -0500 (Wed, 06 Jun 2007) | 13 lines
Merged revisions 67715 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r67715 | russell | 2007-06-06 11:40:51 -0500 (Wed, 06 Jun 2007) | 5 lines
We have some bug reports showing crashes due to a double free of a channel.
Add a sanity check to ast_channel_free() to make sure we don't go on trying
to free a channel that wasn't found in the channel list.
(issue #8850, and others...)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67717 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/linkedlists.h')
-rw-r--r-- | include/asterisk/linkedlists.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 2c9a570c1..1bf933a14 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -729,8 +729,10 @@ struct { \ used to link entries of this list together. \warning The removed entry is \b not freed nor modified in any way. */ -#define AST_LIST_REMOVE(head, elm, field) do { \ +#define AST_LIST_REMOVE(head, elm, field) ({ \ + __typeof(elm) __res = NULL; \ if ((head)->first == (elm)) { \ + __res = (head)->first; \ (head)->first = (elm)->field.next; \ if ((head)->last == (elm)) \ (head)->last = NULL; \ @@ -739,13 +741,15 @@ struct { \ while (curelm && (curelm->field.next != (elm))) \ curelm = curelm->field.next; \ if (curelm) { \ + __res = curelm; \ curelm->field.next = (elm)->field.next; \ if ((head)->last == (elm)) \ (head)->last = curelm; \ } \ } \ - (elm)->field.next = NULL; \ -} while (0) + (elm)->field.next = NULL; \ + (__res); \ +}) #define AST_RWLIST_REMOVE AST_LIST_REMOVE |