RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ depends.c poptALL.c rpminstall.c rpmn...

From: Jeff Johnson <jbj@rpm5.org>
Date: Fri 09 Nov 2007 - 21:11:00 CET
Message-Id: <20071109201100.D5E1D348477@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   09-Nov-2007 21:11:00
  Branch: HEAD                             Handle: 2007110920105901

  Modified files:
    rpm                     CHANGES
    rpm/lib                 depends.c poptALL.c rpminstall.c rpmns.h

  Log:
    - jbj: plug a couple of memory leaks

  Summary:
    Revision    Changes     Path
    1.1781      +1  -0      rpm/CHANGES
    1.358       +20 -6      rpm/lib/depends.c
    2.51        +3  -0      rpm/lib/poptALL.c
    1.180       +5  -2      rpm/lib/rpminstall.c
    1.7         +7  -0      rpm/lib/rpmns.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1780 -r1.1781 CHANGES
  --- rpm/CHANGES	9 Nov 2007 18:00:03 -0000	1.1780
  +++ rpm/CHANGES	9 Nov 2007 20:10:59 -0000	1.1781
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: plug a couple of memory leaks.
       - jbj: rearrange the steaming piles of ick into an aesthetic constellation.
       - jbj: squeaky clean SSL memory cleanup. Ick.
       - rpm.org: start hiding rpmsq internals.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.357 -r1.358 depends.c
  --- rpm/lib/depends.c	3 Nov 2007 23:44:00 -0000	1.357
  +++ rpm/lib/depends.c	9 Nov 2007 20:11:00 -0000	1.358
  @@ -544,6 +544,26 @@
       return rc;
   }
   
  +/*@only@*/ /*@null@*/ /*@unchecked@*/
  +static char *sysinfo_path = NULL;
  +
  +/*@refcounted@*/ /*@null@*/ /*@unchecked@*/
  +static rpmds rpmlibP = NULL;
  +/*@refcounted@*/ /*@null@*/ /*@unchecked@*/
  +static rpmds cpuinfoP = NULL;
  +/*@refcounted@*/ /*@null@*/ /*@unchecked@*/
  +static rpmds getconfP = NULL;
  +/*@refcounted@*/ /*@null@*/ /*@unchecked@*/
  +static rpmds unameP = NULL;
  +
  +void rpmnsClean(void)
  +{
  +    rpmlibP = rpmdsFree(rpmlibP);
  +    cpuinfoP = rpmdsFree(cpuinfoP);
  +    getconfP = rpmdsFree(getconfP);
  +    unameP = rpmdsFree(unameP);
  +}
  +
   /**
    * Check dep for an unsatisfied dependency.
    * @param ts		transaction set
  @@ -570,8 +590,6 @@
       int rc;
       int xx;
       int retries = 10;
  -    /*@only@*/ /*@null@*/
  -    static char *sysinfo_path = NULL;;
   
       if ((Name = rpmdsN(dep)) == NULL)
   	return 0;	/* XXX can't happen */
  @@ -901,7 +919,6 @@
        * Check those dependencies now.
        */
       if (NSType == RPMNS_TYPE_RPMLIB) {
  -	static rpmds rpmlibP = NULL;
   	static int oneshot = -1;
   
   	if (oneshot)
  @@ -917,7 +934,6 @@
       }
   
       if (NSType == RPMNS_TYPE_CPUINFO) {
  -	static rpmds cpuinfoP = NULL;
   	static int oneshot = -1;
   
   	if (oneshot)
  @@ -933,7 +949,6 @@
       }
   
       if (NSType == RPMNS_TYPE_GETCONF) {
  -	static rpmds getconfP = NULL;
   	static int oneshot = -1;
   
   	if (oneshot)
  @@ -949,7 +964,6 @@
       }
   
       if (NSType == RPMNS_TYPE_UNAME) {
  -	static rpmds unameP = NULL;
   	static int oneshot = -1;
   
   	if (oneshot)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/poptALL.c
  ============================================================================
  $ cvs diff -u -r2.50 -r2.51 poptALL.c
  --- rpm/lib/poptALL.c	9 Nov 2007 18:00:07 -0000	2.50
  +++ rpm/lib/poptALL.c	9 Nov 2007 20:11:00 -0000	2.51
  @@ -9,6 +9,7 @@
   #include <rpmio.h>
   #include <rpmcli.h>
   #include <fs.h>			/* XXX rpmFreeFilesystems() */
  +#include <rpmns.h>		/* XXX rpmnsClean() */
   #include <fts.h>
   #include <mire.h>
   
  @@ -513,6 +514,8 @@
   
       rpmioClean();
   
  +    rpmnsClean();
  +
       rpmFreeRpmrc();
   
       rpmFreeFilesystems();
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.179 -r1.180 rpminstall.c
  --- rpm/lib/rpminstall.c	3 Nov 2007 23:44:01 -0000	1.179
  +++ rpm/lib/rpminstall.c	9 Nov 2007 20:11:00 -0000	1.180
  @@ -308,6 +308,8 @@
   {
       HGE_t hge = (HGE_t)headerGetExtension;
       HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
  +    ARGV_t avfn = NULL;
  +    int acfn = 0;
       int numFailed = 0;
       int numRPMS = 0;
       rpmRelocation relocations = NULL;
  @@ -462,8 +464,8 @@
   	}
   
   	/* === Add binary package to transaction set. */
  -	/* XXX xstrdup has memory leak. */
  -	rc = rpmtsAddInstallElement(ts, h, (fnpyKey)xstrdup(fn),
  +	xx = argvAdd(&avfn, fn);
  +	rc = rpmtsAddInstallElement(ts, h, (fnpyKey)avfn[acfn++],
   			(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
   			ia->relocations);
   
  @@ -501,6 +503,7 @@
       if (numFailed) goto exit;
   
   exit:
  +    avfn = argvFree(avfn);
   
   #ifdef	NOTYET	/* XXX grrr, segfault in selabel_close */
       if (!(ia->transFlags & RPMTRANS_FLAG_NOCONTEXTS))
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmns.h
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 rpmns.h
  --- rpm/lib/rpmns.h	6 Oct 2007 21:33:48 -0000	1.6
  +++ rpm/lib/rpmns.h	9 Nov 2007 20:11:00 -0000	1.7
  @@ -106,6 +106,13 @@
   	/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
   	/*@modifies ns, rpmGlobalMacroContext, internalState @*/;
   
  +/** \ingroup rpmns
  + * Clean global name space dependency sets.
  + */
  +void rpmnsClean(void)
  +	/*@globals internalState @*/
  +	/*@modifies internalState @*/;
  +
   #ifdef __cplusplus
   }
   #endif
  @@ .
Received on Fri Nov 9 21:11:00 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.