From: Nick Bowler Date: Mon, 13 Jul 2009 02:51:10 +0000 (-0400) Subject: upkg: Don't forget to close the opened export. X-Git-Url: https://git.draconx.ca/gitweb/upkg.git/commitdiff_plain/94fc44d9acf969477faac61bd60a6812404727f9 upkg: Don't forget to close the opened export. --- 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; }