diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2017-12-07 22:35:59 +0100 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2017-12-09 13:15:35 +0100 |
commit | 4dbee3a3f13657577f283bca22b281d7273c19e5 (patch) | |
tree | 638d62dce7a3e1f4245cb53212e3e422f310be99 /nxcomp/src/Pipe.cpp | |
parent | 2814677a7e2b259669708c89ed55b55dc1c46f9c (diff) | |
download | nx-libs-4dbee3a3f13657577f283bca22b281d7273c19e5.tar.gz nx-libs-4dbee3a3f13657577f283bca22b281d7273c19e5.tar.bz2 nx-libs-4dbee3a3f13657577f283bca22b281d7273c19e5.zip |
nxcomp: use new macro SAFE_FREE(ptr)
Should be used instead of free() calls and will clear the pointer after
calling free(). This can prevent double-free or use-after-free errors.
Diffstat (limited to 'nxcomp/src/Pipe.cpp')
-rw-r--r-- | nxcomp/src/Pipe.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nxcomp/src/Pipe.cpp b/nxcomp/src/Pipe.cpp index 4fa149412..228c556ae 100644 --- a/nxcomp/src/Pipe.cpp +++ b/nxcomp/src/Pipe.cpp @@ -203,7 +203,7 @@ FILE *Popen(char * const parameters[], const char *type) if (pipe(pdes) < 0) { - free(cur); + SAFE_FREE(cur); return NULL; } @@ -237,7 +237,7 @@ FILE *Popen(char * const parameters[], const char *type) close(pdes[0]); close(pdes[1]); - free(cur); + SAFE_FREE(cur); return NULL; } @@ -420,7 +420,7 @@ int Pclose(FILE *iop) last -> next = cur -> next; } - free(cur); + SAFE_FREE(cur); // // Child has finished and we called the |