diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-05-14 10:16:31 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-05-14 10:16:31 +0300 |
commit | 807ba93a6cf168410e3801347898949f356fcd6c (patch) | |
tree | a0bffff8bbf2612bd8e41387e7230b39ff658e96 /build | |
parent | 9a0f820ffc42010da544bdee1758a3c0f6a83aed (diff) | |
download | rpm-807ba93a6cf168410e3801347898949f356fcd6c.tar.gz rpm-807ba93a6cf168410e3801347898949f356fcd6c.tar.bz2 rpm-807ba93a6cf168410e3801347898949f356fcd6c.zip |
Add a helper function for freeing/resetting a file entry, use it
- Now with all the per file-entry data in a struct of its own this
becomes sane and should plug up a couple of leaks as well.
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/build/files.c b/build/files.c index 81a9fd7c9..54651202c 100644 --- a/build/files.c +++ b/build/files.c @@ -188,6 +188,14 @@ static void dumpAttrRec(const char * msg, AttrRec ar) } #endif +static void FileEntryFree(FileEntry entry) +{ + freeAttrRec(&(entry->ar)); + argvFree(entry->langs); + free(entry->caps); + memset(entry, 0, sizeof(*entry)); +} + /** * strtokWithQuotes. * @param s @@ -1801,22 +1809,12 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, rstrlcpy(buf, s, sizeof(buf)); /* Reset for a new line in %files */ - fl.cur.isDir = 0; - fl.cur.attrFlags = 0; + FileEntryFree(&fl.cur); + /* turn explicit flags into %def'd ones (gosh this is hacky...) */ fl.cur.specdFlags = ((unsigned)fl.def.specdFlags) >> 8; fl.cur.verifyFlags = fl.def.verifyFlags; - fl.cur.devtype = 0; - fl.cur.devmajor = 0; - fl.cur.devminor = 0; - - /* XXX should reset to %deflang value */ - fl.cur.langs = argvFree(fl.cur.langs); - fl.cur.caps = NULL; - - freeAttrRec(&fl.cur.ar); - if (parseForVerify(buf, &fl)) continue; if (parseForAttr(buf, &fl)) @@ -1860,16 +1858,9 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, } /* Reset for %doc */ - fl.cur.isDir = 0; - fl.cur.attrFlags = 0; - fl.cur.verifyFlags = fl.def.verifyFlags; - - fl.cur.devtype = 0; - fl.cur.devmajor = 0; - fl.cur.devminor = 0; + FileEntryFree(&fl.cur); - /* XXX should reset to %deflang value */ - fl.cur.langs = argvFree(fl.cur.langs); + fl.cur.verifyFlags = fl.def.verifyFlags; dupAttrRec(specialDocAttrRec, &fl.cur.ar); dupAttrRec(def_specialDocAttrRec, &fl.def.ar); @@ -1896,11 +1887,10 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, exit: fl.buildRoot = _free(fl.buildRoot); - freeAttrRec(&fl.cur.ar); - freeAttrRec(&fl.def.ar); + FileEntryFree(&fl.cur); + FileEntryFree(&fl.def); fl.fileList = freeFileList(fl.fileList, fl.fileListRecsUsed); - argvFree(fl.cur.langs); argvFree(fl.docDirs); return fl.processingFailed ? RPMRC_FAIL : RPMRC_OK; } |