RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm popt Date: 24-Jun-2016 21:04:20 Branch: HEAD rpm-5_4 Handle: 2016062419041802 Modified files: popt CHANGES libpopt.vers popt.c popt.h poptparse.c Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/build build.c parseDescription.c parseFiles.c parsePreamble.c parseScript.c rpm/lib rpmfc.c rpm/misc librpmmisc.vers rpm/rpmdb legacy.c Log: - use poptArgvFree to avoid memory leaks. Summary: Revision Changes Path 1.199 +1 -0 popt/CHANGES 1.12 +1 -0 popt/libpopt.vers 1.165 +1 -6 popt/popt.c 1.83 +7 -2 popt/popt.h 1.40 +1 -1 popt/poptparse.c 1.3501.2.496+2 -0 rpm/CHANGES 2.145.2.4 +1 -1 rpm/build/build.c 2.44.4.5 +1 -1 rpm/build/parseDescription.c 2.36.6.3 +1 -1 rpm/build/parseFiles.c 2.194.2.15 +2 -2 rpm/build/parsePreamble.c 2.80.2.6 +3 -2 rpm/build/parseScript.c 1.75.2.27 +1 -1 rpm/lib/rpmfc.c 1.35.2.12 +1 -0 rpm/misc/librpmmisc.vers 1.44.4.4 +3 -2 rpm/rpmdb/legacy.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: popt/CHANGES ============================================================================ $ cvs diff -u -r1.198 -r1.199 CHANGES --- popt/CHANGES 18 Mar 2016 15:31:18 -0000 1.198 +++ popt/CHANGES 24 Jun 2016 19:04:19 -0000 1.199 @@ -1,4 +1,5 @@ 1.17 -> 2.0: + - jbj: use poptArgvFree to avoid memory leaks. - jbj: i18n: update PO files (Translation Project). - jbj: i18n: update PO files (Translation Project). - jbj: i18n: update da fr nb nl uk, and msgmerge (Translation Project). @@ . patch -p0 <<'@@ .' Index: popt/libpopt.vers ============================================================================ $ cvs diff -u -r1.11 -r1.12 libpopt.vers --- popt/libpopt.vers 28 Aug 2009 00:06:33 -0000 1.11 +++ popt/libpopt.vers 24 Jun 2016 19:04:19 -0000 1.12 @@ -8,6 +8,7 @@ poptAddAlias; poptAddItem; poptAliasOptions; + poptArgvFree; poptBadOption; _poptBitsN; _poptBitsM; @@ . patch -p0 <<'@@ .' Index: popt/popt.c ============================================================================ $ cvs diff -u -r1.164 -r1.165 popt.c --- popt/popt.c 28 Mar 2016 22:01:08 -0000 1.164 +++ popt/popt.c 24 Jun 2016 19:04:19 -0000 1.165 @@ -1770,12 +1770,7 @@ if (items != NULL) { poptItem item = items; while (--nitems >= 0) { -#if !defined(SUPPORT_CONTIGUOUS_ARGV) - int i; - for (i = 0; item->argv[i]; i++) - item->argv[i] = _free(item->argv[i]); -#endif - item->argv = _free(item->argv); + item->argv = poptArgvFree(item->argv); /*@-modobserver -observertrans -dependenttrans@*/ item->option.longName = _free(item->option.longName); item->option.descrip = _free(item->option.descrip); @@ . patch -p0 <<'@@ .' Index: popt/popt.h ============================================================================ $ cvs diff -u -r1.82 -r1.83 popt.h --- popt/popt.h 11 Nov 2014 18:51:50 -0000 1.82 +++ popt/popt.h 24 Jun 2016 19:04:19 -0000 1.83 @@ -470,8 +470,6 @@ * Parse a string into an argument array. * The parse allows ', ", and \ quoting, but ' is treated the same as " and * both may include \ quotes. - * @note: The argument array is malloc'd as a single area, so only argv must - * be free'd. * * @param s string to parse * @retval argcPtr address of returned no. of arguments @@ -482,6 +480,13 @@ /*@modifies *argcPtr, *argvPtr @*/; /** \ingroup popt + * Free the argument array. + * @param argv argument array. + * @retval NULL always + */ +const char ** poptArgvFree(const char ** argv); + +/** \ingroup popt * Parses an input configuration file and returns an string that is a * command line. For use with popt. You must free the return value when done. * @@ . patch -p0 <<'@@ .' Index: popt/poptparse.c ============================================================================ $ cvs diff -u -r1.39 -r1.40 poptparse.c --- popt/poptparse.c 13 May 2015 13:09:27 -0000 1.39 +++ popt/poptparse.c 24 Jun 2016 19:04:19 -0000 1.40 @@ -16,7 +16,7 @@ #define assert(_x) #endif -static const char ** poptArgvFree(/*@only@*/ const char ** av) +const char ** poptArgvFree(/*@only@*/ const char ** av) { #if !defined(SUPPORT_CONTIGUOUS_ARGV) if (av) { @@ . patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3501.2.495 -r1.3501.2.496 CHANGES --- rpm/CHANGES 22 Jun 2016 22:48:32 -0000 1.3501.2.495 +++ rpm/CHANGES 24 Jun 2016 19:04:18 -0000 1.3501.2.496 @@ -1,4 +1,6 @@ 5.4.17 -> 5.4.18: + - jbj: use poptArgvFree to avoid memory leaks. + - jbj: autofu: don't bother carrying around install-sh/mkinstalldirs. - jbj: autofu: default db-utils seaches to $PATH. - jbj: gnulib: stub in include from gnulib/*.h before /usr/include. - jbj: gnulib: stub in merge gnulib -> librpmmisc. @@ . patch -p0 <<'@@ .' Index: rpm/build/build.c ============================================================================ $ cvs diff -u -r2.145.2.3 -r2.145.2.4 build.c --- rpm/build/build.c 17 Sep 2014 03:36:20 -0000 2.145.2.3 +++ rpm/build/build.c 24 Jun 2016 19:04:19 -0000 2.145.2.4 @@ -327,7 +327,7 @@ break; } - argv = _free(argv); + argv = poptArgvFree(argv); buildCmd = _free(buildCmd); buildTemplate = _free(buildTemplate); buildPost = _free(buildPost); @@ . patch -p0 <<'@@ .' Index: rpm/build/parseDescription.c ============================================================================ $ cvs diff -u -r2.44.4.4 -r2.44.4.5 parseDescription.c --- rpm/build/parseDescription.c 21 Mar 2016 22:08:51 -0000 2.44.4.4 +++ rpm/build/parseDescription.c 24 Jun 2016 19:04:19 -0000 2.44.4.5 @@ -143,7 +143,7 @@ exit: iob = rpmiobFree(iob); - argv = _free(argv); + argv = poptArgvFree(argv); optCon = poptFreeContext(optCon); return nextPart; } @@ . patch -p0 <<'@@ .' Index: rpm/build/parseFiles.c ============================================================================ $ cvs diff -u -r2.36.6.2 -r2.36.6.3 parseFiles.c --- rpm/build/parseFiles.c 25 Mar 2011 17:45:46 -0000 2.36.6.2 +++ rpm/build/parseFiles.c 24 Jun 2016 19:04:19 -0000 2.36.6.3 @@ -122,7 +122,7 @@ #endif exit: - argv = _free(argv); + argv = poptArgvFree(argv); optCon = poptFreeContext(optCon); return rc; @@ . patch -p0 <<'@@ .' Index: rpm/build/parsePreamble.c ============================================================================ $ cvs diff -u -r2.194.2.14 -r2.194.2.15 parsePreamble.c --- rpm/build/parsePreamble.c 12 Apr 2016 04:52:07 -0000 2.194.2.14 +++ rpm/build/parsePreamble.c 24 Jun 2016 19:04:19 -0000 2.194.2.15 @@ -90,7 +90,7 @@ xx = headerPut(h, he, 0); he->append = 0; } - argv = _free(argv); + argv = poptArgvFree(argv); } /* Parse a simple part line that only take -n <pkg> or <pkg> */ @@ -911,7 +911,7 @@ } pkg->noarch = 1; } - BANames = _free(BANames); + BANames = poptArgvFree(BANames); } break; default: @@ . patch -p0 <<'@@ .' Index: rpm/build/parseScript.c ============================================================================ $ cvs diff -u -r2.80.2.5 -r2.80.2.6 parseScript.c --- rpm/build/parseScript.c 12 Oct 2014 21:22:36 -0000 2.80.2.5 +++ rpm/build/parseScript.c 24 Jun 2016 19:04:19 -0000 2.80.2.6 @@ -9,6 +9,7 @@ #include <rpmiotypes.h> #include <rpmlog.h> #include <rpmlua.h> +#include <argv.h> #define _RPMEVR_INTERNAL #include "rpmbuild.h" @@ -476,8 +477,8 @@ exit: iob = rpmiobFree(iob); - progArgv = _free(progArgv); - argv = _free(argv); + progArgv = poptArgvFree(progArgv); + argv = poptArgvFree(argv); optCon = poptFreeContext(optCon); return rc; @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmfc.c ============================================================================ $ cvs diff -u -r1.75.2.26 -r1.75.2.27 rpmfc.c --- rpm/lib/rpmfc.c 10 May 2016 17:02:17 -0000 1.75.2.26 +++ rpm/lib/rpmfc.c 24 Jun 2016 19:04:19 -0000 1.75.2.27 @@ -279,7 +279,7 @@ exit: iob = rpmiobFree(iob); xav = argvFree(xav); - pav = _free(pav); /* XXX popt mallocs in single blob. */ + pav = poptArgvFree(pav); s = _free(s); return ec; } @@ . patch -p0 <<'@@ .' Index: rpm/misc/librpmmisc.vers ============================================================================ $ cvs diff -u -r1.35.2.11 -r1.35.2.12 librpmmisc.vers --- rpm/misc/librpmmisc.vers 19 Jun 2016 08:53:46 -0000 1.35.2.11 +++ rpm/misc/librpmmisc.vers 24 Jun 2016 19:04:19 -0000 1.35.2.12 @@ -215,6 +215,7 @@ poptAddAlias; poptAddItem; poptAliasOptions; + poptArgvFree; poptBadOption; _poptBitsN; _poptBitsM; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/legacy.c ============================================================================ $ cvs diff -u -r1.44.4.3 -r1.44.4.4 legacy.c --- rpm/rpmdb/legacy.c 16 Apr 2012 23:43:34 -0000 1.44.4.3 +++ rpm/rpmdb/legacy.c 24 Jun 2016 19:04:20 -0000 1.44.4.4 @@ -76,8 +76,8 @@ int bingo; static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER; static yarnLock oneshot = NULL; /* XXX memleak */ - static const char ** cmd_av = NULL; /* XXX memleak */ - static int cmd_ac = 0; + const char ** cmd_av = NULL; + int cmd_ac = 0; int xx; xx = pthread_mutex_lock(&_mutex); @@ -162,6 +162,7 @@ fdno = pipes[0]; xx = close(pipes[1]); *pidp = pid; + cmd_av = poptArgvFree(cmd_av); break; } } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org