diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-11 01:26:09 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-11 01:26:09 +0000 |
commit | 8ca09cb9474e4775f0e0ac48b10e8f6d71f00a52 (patch) | |
tree | 0244347e29888779d14c472de4320855070d62e8 /include | |
parent | 5d400b777bcfd632691db4df9191db6492d07113 (diff) |
Bug 5965 - major bug in AST_LIST_REMOVE
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7428 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/linkedlists.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index cfe846225..f687189e2 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -424,15 +424,16 @@ struct { \ #define AST_LIST_REMOVE(head, elm, field) do { \ if ((head)->first == (elm)) { \ (head)->first = (elm)->field.next; \ - } \ - else { \ + if ((head)->last = (elm)) \ + (head)->last = NULL; \ + } else { \ typeof(elm) curelm = (head)->first; \ while (curelm->field.next != (elm)) \ curelm = curelm->field.next; \ curelm->field.next = (elm)->field.next; \ + if ((head)->last == curelm->field.next) \ + (head)->last = curelm; \ } \ - if ((head)->last == elm) \ - (head)->last = NULL; \ } while (0) #endif /* _ASTERISK_LINKEDLISTS_H */ |