From 919cb658188c6faf574aa17dbb8bb91ac2008994 Mon Sep 17 00:00:00 2001 From: midipix Date: Nov 11 2016 05:22:31 +0000 Subject: driver: add missing close-fd-upon-error in driver-level handling of stdin. --- 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()))