summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-11-23 00:58:42 -0500
committermidipix <writeonce@midipix.org>2016-11-10 23:35:26 -0500
commit2699a2c19915973ed75b1c437fd4554ccf99979e (patch)
treec70c19154c0762e9c5b9912759292af590c4b11a /src/driver
parent846f96ecfe93b8f3cb08b0baa8296f20b7a3974b (diff)
downloadperk-2699a2c19915973ed75b1c437fd4554ccf99979e.tar.bz2
perk-2699a2c19915973ed75b1c437fd4554ccf99979e.tar.xz
pe_get_driver_ctx(): close fdout as needed upon allocation failure.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/pe_driver_ctx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c
index 1054ac7..af1c0e3 100644
--- a/src/driver/pe_driver_ctx.c
+++ b/src/driver/pe_driver_ctx.c
@@ -148,7 +148,10 @@ int pe_get_driver_ctx(
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0))
return pe_get_driver_ctx_fail(meta);
- if (!(ctx = pe_driver_ctx_alloc(meta,nunits)))
+ if (!(ctx = pe_driver_ctx_alloc(meta,nunits)) && output)
+ close(fdout);
+
+ if (!ctx)
return pe_get_driver_ctx_fail(meta);
ctx->program = program;