mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
evbuffer: fix last_with_datap after prepend with empty chain
last_with_datap should be adjusted only if it buf->first *was* not empty, otherwise last_with_datap should point to the prepended chain.
This commit is contained in:
parent
244cacaf8c
commit
401bd1c09e
2
buffer.c
2
buffer.c
@ -1905,7 +1905,7 @@ evbuffer_prepend(struct evbuffer *buf, const void *data, size_t datlen)
|
||||
if ((tmp = evbuffer_chain_new(datlen)) == NULL)
|
||||
goto done;
|
||||
buf->first = tmp;
|
||||
if (buf->last_with_datap == &buf->first)
|
||||
if (buf->last_with_datap == &buf->first && chain->off)
|
||||
buf->last_with_datap = &tmp->next;
|
||||
|
||||
tmp->next = chain;
|
||||
|
Loading…
x
Reference in New Issue
Block a user