projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c610dea
)
FDIO: check for double freeing of an FDIO resource to fix possible double close ...
author
Wilfried Goesgens
<dothebart@citadel.org>
Thu, 15 Aug 2013 21:25:32 +0000
(23:25 +0200)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Thu, 15 Aug 2013 21:25:32 +0000
(23:25 +0200)
libcitadel/lib/stringbuf.c
patch
|
blob
|
history
diff --git
a/libcitadel/lib/stringbuf.c
b/libcitadel/lib/stringbuf.c
index bd67e0d48a93ad19eee581390e115d970de3ce0b..9bc1c8eb04aa9015ab7f5d62abdd50fe5b2d0175 100644
(file)
--- a/
libcitadel/lib/stringbuf.c
+++ b/
libcitadel/lib/stringbuf.c
@@
-3955,14
+3955,17
@@
void FDIOBufferDelete(FDIOBuffer *FDB)
#ifdef LINUX_SPLICE
if (EnableSplice)
{
- close(FDB->SplicePipe[0]);
- close(FDB->SplicePipe[1]);
+ if (FDB->SplicePipe[0] > 0)
+ close(FDB->SplicePipe[0]);
+ if (FDB->SplicePipe[1] > 0)
+ close(FDB->SplicePipe[1]);
}
else
#endif
FreeStrBuf(&FDB->ChunkBuffer);
- close(FDB->OtherFD);
+ if (FDB->OtherFD > 0)
+ close(FDB->OtherFD);
memset(FDB, 0, sizeof(FDIOBuffer));
}