]> granicus.if.org Git - libevent/commit
evbuffer_add_file: fix freeing of segment in the error path
authorAzat Khuzhin <azat@libevent.org>
Sat, 21 Sep 2019 20:30:48 +0000 (23:30 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 21 Sep 2019 20:32:55 +0000 (23:32 +0300)
commit4727150a54e21725f0ef4f43ca5028cc6f353664
treeea6c647928bb0b4c9ce6b53639d2e7d11d8f6ec2
parent148d12ad31b03a813f4ffd9df14a85392aa74130
evbuffer_add_file: fix freeing of segment in the error path

if evbuffer_add_file_segment() fails it returns -1, so we should call
evbuffer_file_segment_free() only on error, and this -1 not 0.

Fixes: 6a81b1f5 ("Avoid double-free on error in evbuffer_add_file. Found by coverity.")
Backport-to: 2.1
buffer.c