summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2019-05-11 00:17:03 +0300
committerAzat Khuzhin <azat@libevent.org>2019-05-16 10:16:21 +0300
commit401bd1c09e9753ce997539c177cb1e48025a7343 (patch)
treec89eff40efe4033a0c076d3920526be44302a633 /buffer.c
parent244cacaf8ccfe8b8978df20791998bbc92225dc8 (diff)
downloadlibevent-401bd1c09e9753ce997539c177cb1e48025a7343.tar.gz
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.
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 11b1bdae..6ad8fd24 100644
--- a/buffer.c
+++ b/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;