summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-12-25 00:04:47 -0500
committermidipix <writeonce@midipix.org>2016-11-11 00:22:31 -0500
commit919cb658188c6faf574aa17dbb8bb91ac2008994 (patch)
tree0f9940b5e5541d2ae9ac2e67712649dfca7c263f
parent8e35a769a8a35719d1733d0d7dd55c717f607043 (diff)
downloadmdso-919cb658188c6faf574aa17dbb8bb91ac2008994.tar.bz2
mdso-919cb658188c6faf574aa17dbb8bb91ac2008994.tar.xz
driver: add missing close-fd-upon-error in driver-level handling of stdin.
-rw-r--r--src/driver/mdso_unit_ctx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/driver/mdso_unit_ctx.c b/src/driver/mdso_unit_ctx.c
index 14fbe27..ae90394 100644
--- a/src/driver/mdso_unit_ctx.c
+++ b/src/driver/mdso_unit_ctx.c
@@ -49,7 +49,10 @@ static FILE * mdso_stdin_to_tmp(const struct mdso_driver_ctx * dctx)
if ((fdtmp = dup(ictx->fdtmpin)) < 0)
return 0;
- return fdopen(fdtmp,"r");
+ if (!(ftmp = fdopen(fdtmp,"r")))
+ close(fdtmp);
+
+ return ftmp;
}
if (!(ftmp = tmpfile()))