inliniac/suricata — pull request #826 by ken-tilera (2014-02-06 16:11:37+00:00)
Title: Fix DetectReplaceAddToList

I see two problems:
1) If allocating a newlist fails, the function returns NULL, which then
leaks any existing list elements.
2) The code to add the new value to the list works for the first two, but
for not the third. For example, replist=A, A->next=B, B->next=NULL, then
adding C results in replist=A, A->next=C, C->next=NULL, B is lost.

The fix pushes new values onto the head of the list, which might not be
what is needed, but there are no comments on what the function does, so I
made an assumption.

@regit - Your name is on this file, so you should probably review this proposed fix.

Replaces PR 742: https://github.com/inliniac/suricata/pull/742

Passes prscript.py:
- PR build: https://buildbot.suricata-ids.org/builders/ken-tilera/builds/110
- PR pcaps: https://buildbot.suricata-ids.org/builders/ken-tilera-pcap/builds/44