From 919cb658188c6faf574aa17dbb8bb91ac2008994 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 25 Dec 2015 00:04:47 -0500 Subject: driver: add missing close-fd-upon-error in driver-level handling of stdin. --- src/driver/mdso_unit_ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/driver') 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())) -- cgit v1.2.3