Index: include/asterisk/linkedlists.h =================================================================== --- include/asterisk/linkedlists.h (revision 328266) +++ include/asterisk/linkedlists.h (working copy) @@ -854,7 +854,9 @@ (head)->last = curelm; \ } \ } \ - (elm)->field.next = NULL; \ + if (__res) { \ + (__res)->field.next = NULL; \ + } \ (__res); \ })