From: Andre Noll Date: Mon, 20 Sep 2021 18:42:37 +0000 (+0200) Subject: vss: Avoid double free on exit. X-Git-Tag: v0.6.4~12 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=d9dd85a61ac70314c4842d7ad28bf5eb65c8c712 vss: Avoid double free on exit. When para_server fails to receive the fd for the next audio file, the memory pointed to by mmd->afd.afhi.chunk_table is freed but the pointer is not set to NULL. If the failure was due to server and afs receiving SIGINT, the subsequent signal handling code might attempt to free the chunk table again. This double free error is detected by glibc, which results resulting in messages such as free(): invalid size Aborted Fortunately, this is easy to fix. --- diff --git a/vss.c b/vss.c index 101fdb88..4b1bfc78 100644 --- a/vss.c +++ b/vss.c @@ -1001,6 +1001,7 @@ static void recv_afs_result(struct vss_task *vsst, fd_set *rfds) return; err: free(mmd->afd.afhi.chunk_table); + mmd->afd.afhi.chunk_table = NULL; if (passed_fd >= 0) close(passed_fd); PARA_ERROR_LOG("%s\n", para_strerror(-ret));