From: Panu Matilainen Date: Mon, 7 Sep 2009 13:59:01 +0000 (+0300) Subject: Single point of exit for doPatch() to clean up freeing X-Git-Tag: rpm-4.8.0-beta1~313 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=caa6dc91acd958928eeaf440ade7f01311bcf330;p=platform%2Fupstream%2Frpm.git Single point of exit for doPatch() to clean up freeing --- diff --git a/build/parsePrep.c b/build/parsePrep.c index 5a0769d..44d6058 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -49,7 +49,7 @@ static rpmRC checkOwners(const char * urlfn) static char *doPatch(rpmSpec spec, uint32_t c, int strip, const char *db, int reverse, int removeEmpties, int fuzz, const char *dir) { - char *fn; + char *fn = NULL; char *buf = NULL; char *arg_backup = NULL; char *arg_fuzz = NULL; @@ -70,16 +70,13 @@ static char *doPatch(rpmSpec spec, uint32_t c, int strip, const char *db, } else { rpmlog(RPMLOG_ERR, _("%%patch without corresponding \"Patch:\" tag\n")); } - return NULL; + goto exit; } fn = rpmGetPath("%{_sourcedir}/", sp->source, NULL); /* On non-build parse's, file cannot be stat'd or read. */ - if (spec->force || checkOwners(fn)) { - fn = _free(fn); - return NULL; - } + if (spec->force || checkOwners(fn)) goto exit; if (db) { rasprintf(&arg_backup, @@ -118,9 +115,10 @@ static char *doPatch(rpmSpec spec, uint32_t c, int strip, const char *db, "%s\n", basename(fn), patchcmd); } - free(fn); free(patchcmd); - + +exit: + free(fn); return buf; }