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                              Date:   30-May-2009 17:41:08
  Branch: HEAD                             Handle: 2009053015410701

  Modified files:
    rpm                     rpmqv.c system.h
    rpm/build               files.c
    rpm/misc                librpmmisc.vers setproctitle.c

  Log:
    - eliminate some memory leaks.

  Summary:
    Revision    Changes     Path
    1.357       +3  -4      rpm/build/files.c
    1.23        +1  -0      rpm/misc/librpmmisc.vers
    1.4         +24 -3      rpm/misc/setproctitle.c
    1.162       +5  -0      rpm/rpmqv.c
    2.121       +3  -0      rpm/system.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/build/files.c
  ============================================================================
  $ cvs diff -u -r1.356 -r1.357 files.c
  --- rpm/build/files.c 3 May 2009 16:57:33 -0000       1.356
  +++ rpm/build/files.c 30 May 2009 15:41:07 -0000      1.357
  @@ -1576,8 +1576,7 @@
        he->append = 0;
        
        /* Add file security context to package. */
  -     if (!(_rpmbuildFlags & 4))
  -     {
  +     if (sxfn != NULL && *sxfn != '\0' && !(_rpmbuildFlags & 4)) {
            /*...@observer@*/
            static char *nocon = "";
   /*...@-moduncon@*/
  @@ -2707,10 +2706,9 @@
       int rc;
       /* srcdefattr: needed variables */
       char _srcdefattr_buf[BUFSIZ];
  -    char *_srcdefattr;
  +    char * _srcdefattr = rpmExpand("%{?_srcdefattr}", NULL);
       int xx;
   
  -    _srcdefattr = rpmExpand("%{?_srcdefattr}", NULL);
   
       *sfp = rpmiobNew(0);
       x = initSourceHeader(spec, sfp);
  @@ -2805,6 +2803,7 @@
   exit:
       *sfp = rpmiobFree(*sfp);
       fl.fileList = freeFileList(fl.fileList, fl.fileListRecsUsed);
  +    _srcdefattr = _free(_srcdefattr);
       return rc;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/librpmmisc.vers
  ============================================================================
  $ cvs diff -u -r1.22 -r1.23 librpmmisc.vers
  --- rpm/misc/librpmmisc.vers  29 May 2009 17:29:05 -0000      1.22
  +++ rpm/misc/librpmmisc.vers  30 May 2009 15:41:08 -0000      1.23
  @@ -11,6 +11,7 @@
       ficlSystemCreateVm;
       ficlSystemDestroy;
       ficlVmEvaluate;
  +    finiproctitle;
       initproctitle;
       setproctitle;
       JS_*;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/setproctitle.c
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 setproctitle.c
  --- rpm/misc/setproctitle.c   29 May 2009 21:54:20 -0000      1.3
  +++ rpm/misc/setproctitle.c   30 May 2009 15:41:08 -0000      1.4
  @@ -91,9 +91,30 @@
   }
   
   /*
  -  It has to be _init function, because __attribute__((constructor))
  -  functions gets called without arguments.
  -*/
  + * Rename to _init/_fini for automagic ELF weak symbol library symbol 
override.
  + * Note: __attribute__((constructor)) on _init function is
  + * called without arguments.
  + */
  +
  +int
  +finiproctitle(void)
  +{
  +/* XXX limit the fiddle up to linux for now. */
  +#if defined(__linux__)
  +    if (title_buffer != NULL) {
  +     char ** envp;
  +     for (envp = environ; *envp != NULL; envp++) {
  +         free(*envp);
  +         *envp = NULL;
  +     }
  +     free(environ);
  +     environ = NULL;
  +     free(title_progname_full);
  +     title_progname_full = NULL;
  +    }
  +#endif
  +    return 0;
  +}
   
   int
   initproctitle(int argc, char *argv[], char *envp[])
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmqv.c
  ============================================================================
  $ cvs diff -u -r1.161 -r1.162 rpmqv.c
  --- rpm/rpmqv.c       30 May 2009 14:06:00 -0000      1.161
  +++ rpm/rpmqv.c       30 May 2009 15:41:07 -0000      1.162
  @@ -1082,6 +1082,11 @@
   
       optCon = rpmcliFini(optCon);
   
  +/* XXX limit the fiddle up to linux for now. */
  +#if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
  +    (void) finiproctitle();
  +#endif
  +
       /* XXX don't overflow single byte exit status */
       /* XXX status 255 is special to xargs(1) */
       if (ec > 254) ec = 254;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/system.h
  ============================================================================
  $ cvs diff -u -r2.120 -r2.121 system.h
  --- rpm/system.h      29 May 2009 17:29:05 -0000      2.120
  +++ rpm/system.h      30 May 2009 15:41:07 -0000      2.121
  @@ -460,6 +460,9 @@
   
   /* XXX limit the fiddle up to linux for now. */
   #if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
  +extern int finiproctitle(void)
  +     /*...@globals environ @*/
  +     /*...@modifies environ @*/;
   extern int initproctitle(int argc, char *argv[], char *envp[])
        /*...@globals environ @*/
        /*...@modifies environ @*/;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to