Don't leak f_out file desciptor if specified more than once
[fio.git] / options.c
index 5c372b6964c0eb078737732131cbbb63c7541f10..9096a322bbc089db652662f8a1b04defd3f228b3 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3656,8 +3656,10 @@ static char *bc_calc(char *str)
                return NULL;
 
        ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
-       if (ret <= 0)
+       if (ret <= 0) {
+               pclose(f);
                return NULL;
+       }
 
        pclose(f);
        buf[(tmp - str) + ret - 1] = '\0';