diff options
author | Patrick McHardy <kaber@trash.net> | 2011-07-22 16:44:20 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-07-22 16:44:20 +0200 |
commit | 2b9be10b177024bd663bd5fce19ea0fb76260c27 (patch) | |
tree | f6c296350683ee94c120213bef57e14fd153b23a /include/asterisk/linkedlists.h | |
parent | 916e420bf0c8db7a8cb1f60557cd2807652142cf (diff) | |
parent | 28da2a199d7e1624ac56ccb27d3671117f4e2717 (diff) |
Diffstat (limited to 'include/asterisk/linkedlists.h')
-rw-r--r-- | include/asterisk/linkedlists.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 8e86470f5..4c9e27b28 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -838,7 +838,10 @@ struct { \ */ #define AST_LIST_REMOVE(head, elm, field) ({ \ __typeof(elm) __res = NULL; \ - if ((head)->first == (elm)) { \ + __typeof(elm) __tmp = elm; \ + if (!__tmp) { \ + __res = NULL; \ + } else if ((head)->first == (elm)) { \ __res = (head)->first; \ (head)->first = (elm)->field.next; \ if ((head)->last == (elm)) \ @@ -854,7 +857,9 @@ struct { \ (head)->last = curelm; \ } \ } \ - (elm)->field.next = NULL; \ + if (__res) { \ + (__res)->field.next = NULL; \ + } \ (__res); \ }) |