Fix double free crash during encrypted backups

Calling flush_libtar_buffer would inadvertantly set buffer_status
when no buffer is currently allocated. Later when we called
free_libtar_buffer, this would attempt to free the write_buffer
and cause a crash. This patch checks the value of buffer_status in
flush_libtar_buffer to prevent us from freeing the buffer when it
is not necessary.

Change-Id: Ic5b462fe5881be6e9c6fcc355b369bc90477f737
This commit is contained in:
Ethan Yonker
2015-06-01 09:55:04 -05:00
parent 5267a21667
commit 74db84e026
+2 -1
View File
@@ -88,5 +88,6 @@ ssize_t write_libtar_buffer(int fd, const void *buffer, size_t size) {
void flush_libtar_buffer(int fd) {
eot_count = 0;
buffer_status = 2;
if (buffer_status)
buffer_status = 2;
}