[hackers] [scc] [driver] fix double free in cleanup() with multiple sources || Quentin Rameau

From: <git_AT_suckless.org>
Date: Thu, 2 Jun 2016 19:26:36 +0200 (CEST)

commit 369c0899dae84b514d1ef70d6a69bd09fa3557d2
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Jun 2 19:13:39 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Thu Jun 2 19:14:01 2016 +0200

    [driver] fix double free in cleanup() with multiple sources

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index bb6bda8..4072f97 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -52,9 +52,12 @@ cleanup(void)
         int i;
 
         for (i = 0; i < NR_TOOLS; ++i) {
- if (i > failedtool && outfiles[i])
- unlink(outfiles[i]);
- free(outfiles[i]);
+ if (outfiles[i]) {
+ if (i > failedtool)
+ unlink(outfiles[i]);
+ free(outfiles[i]);
+ outfiles[i] = NULL;
+ }
         }
 }
 
Received on Thu Jun 02 2016 - 19:26:36 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 02 2016 - 19:36:14 CEST