ref: 998208fd1c18fcbbf2a5bcabdbcec72649cfc387
parent: 1968a7f090862f32f35bf1854965334896aac41b
author: Mans Rullgard <mans@mansr.com>
date: Thu Aug 27 12:57:26 EDT 2015
hcom: fix double free on writing zero-length file
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -445,9 +445,10 @@
int rc = SOX_SUCCESS;
/* Compress it all at once */
- if (compressed_len)
+ if (compressed_len) {
compress(ft, &compressed_data, (int32_t *)&compressed_len);
- free(p->data);
+ free(p->data);
+ }
/* Write the header */
lsx_writebuf(ft, "\000\001A", (size_t) 3); /* Dummy file name "A" */