From 94fc44d9acf969477faac61bd60a6812404727f9 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sun, 12 Jul 2009 22:51:10 -0400 Subject: [PATCH] upkg: Don't forget to close the opened export. --- src/upkg.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/upkg.c b/src/upkg.c index ed6d4df..82a673d 100644 --- a/src/upkg.c +++ b/src/upkg.c @@ -156,10 +156,10 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx) struct upkg_file *f = upkg_export_open(pkg, idx); char name[256]; FILE *of; - int rc; + int rc = -1; if (u_object_deserialize(obj, f) != 0) { - return -1; + goto out; } u_object_export_name(obj, name, sizeof name); @@ -167,16 +167,19 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx) of = fopen(name, "wb"); if (!of) { perror(name); - return -1; + goto out; } rc = u_object_export(obj, of); if (fclose(of) != 0) { perror(name); - return -1; + rc = -1; + goto out; } +out: + upkg_export_close(f); return rc; } -- 2.43.0