diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-09-07 16:59:01 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-09-07 16:59:01 +0300 |
commit | caa6dc91acd958928eeaf440ade7f01311bcf330 (patch) | |
tree | 0ab8f62f2665c795fd83a7478956ca65448e2b3d /build | |
parent | 23307f3823bc0457cabb19c4bf9bfac0cdde84e8 (diff) | |
download | rpm-caa6dc91acd958928eeaf440ade7f01311bcf330.tar.gz rpm-caa6dc91acd958928eeaf440ade7f01311bcf330.tar.bz2 rpm-caa6dc91acd958928eeaf440ade7f01311bcf330.zip |
Single point of exit for doPatch() to clean up freeing
Diffstat (limited to 'build')
-rw-r--r-- | build/parsePrep.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c index 5a0769de8..44d605877 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; } |