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:   09-Sep-2014 19:12:09
  Branch: rpm-5_4                          Handle: 2014090917120404

  Modified files:           (Branch: rpm-5_4)
    rpm/build               parseReqs.c
    rpm/lib                 rpmchecksig.c
    rpm/rpmdb               signature.c
    rpm/rpmio               rpmgc.c rpmgit.c rpmsx.c

  Log:
    - clang: fix some memory leaks.

  Summary:
    Revision    Changes     Path
    2.57.4.1    +1  -1      rpm/build/parseReqs.c
    1.240.2.13  +1  -0      rpm/lib/rpmchecksig.c
    1.68.2.10   +3  -41     rpm/rpmdb/signature.c
    2.34.2.10   +8  -0      rpm/rpmio/rpmgc.c
    2.1.2.49    +4  -0      rpm/rpmio/rpmgit.c
    2.4.4.4     +7  -7      rpm/rpmio/rpmsx.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/build/parseReqs.c
  ============================================================================
  $ cvs diff -u -r2.57 -r2.57.4.1 parseReqs.c
  --- rpm/build/parseReqs.c     13 Jun 2009 09:07:44 -0000      2.57
  +++ rpm/build/parseReqs.c     9 Sep 2014 17:12:04 -0000       2.57.4.1
  @@ -177,7 +177,7 @@
            if (!(nr > 3 && EVR[0] == '%' && EVR[1] == '{' && EVR[nr-1] == '}'))
            {
                memset(evr, 0, sizeof(*evr));
  -             ix = rpmEVRparse(xstrdup(EVR), evr);
  +             ix = rpmEVRparse(EVR, evr);
                evr->str = _free(evr->str);
            }
            if (ix != 0) {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmchecksig.c
  ============================================================================
  $ cvs diff -u -r1.240.2.12 -r1.240.2.13 rpmchecksig.c
  --- rpm/lib/rpmchecksig.c     16 May 2014 20:31:06 -0000      1.240.2.12
  +++ rpm/lib/rpmchecksig.c     9 Sep 2014 17:12:06 -0000       1.240.2.13
  @@ -313,6 +313,7 @@
            (void)headerFree(nh);
            nh = NULL;
        }
  +     he->p.ptr = _free(he->p.ptr);
   
   if (sigh != NULL) {
        /* Eliminate broken digest values. */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/signature.c
  ============================================================================
  $ cvs diff -u -r1.68.2.9 -r1.68.2.10 signature.c
  --- rpm/rpmdb/signature.c     19 Jul 2014 19:03:55 -0000      1.68.2.9
  +++ rpm/rpmdb/signature.c     9 Sep 2014 17:12:07 -0000       1.68.2.10
  @@ -379,47 +379,8 @@
            goto exit;
        ret = 0;
      } break;
  -   case RPMSIGTAG_DSA:
  -     fd = Fopen(file, "r.fdio");
  -     if (fd == NULL || Ferror(fd))
  -         goto exit;
  -     {   const char item[] = "Header";
  -         msg = NULL;
  -         rc = rpmpkgRead(item, fd, &h, &msg);
  -         if (rc != RPMRC_OK) {
  -             rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  -             msg = _free(msg);
  -             goto exit;
  -         }
  -         msg = _free(msg);
  -     }
  -     (void) Fclose(fd);      fd = NULL;
  -
  -     if (rpmTempFile(NULL, &fn, &fd))
  -         goto exit;
  -     {   const char item[] = "Header";
  -         msg = NULL;
  -         rc = rpmpkgWrite(item, fd, h, &msg);
  -         if (rc != RPMRC_OK) {
  -             rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  -             msg = _free(msg);
  -             goto exit;
  -         }
  -         msg = _free(msg);
  -     }
  -     (void) Fclose(fd);      fd = NULL;
  -
  -     if (makeGPGSignature(fn, &sigTag, &pkt, &pktlen, passPhrase))
  -         goto exit;
  -     he->tag = (rpmTag) sigTag;
  -     he->t = RPM_BIN_TYPE;
  -     he->p.ptr = pkt;
  -     he->c = pktlen;
  -     xx = headerPut(sigh, he, 0);
  -     if (!xx)
  -         goto exit;
  -     ret = 0;
  -     break;
  +    case RPMSIGTAG_RSA:
  +    case RPMSIGTAG_DSA:
       case RPMSIGTAG_ECDSA:    /* XXX necessary when gnupg2 supports ECDSA */
        fd = Fopen(file, "r.fdio");
        if (fd == NULL || Ferror(fd))
  @@ -457,6 +418,7 @@
        he->p.ptr = pkt;
        he->c = pktlen;
        xx = headerPut(sigh, he, 0);
  +     pkt = _free(pkt);
        if (!xx)
            goto exit;
        ret = 0;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmgc.c
  ============================================================================
  $ cvs diff -u -r2.34.2.9 -r2.34.2.10 rpmgc.c
  --- rpm/rpmio/rpmgc.c 13 May 2014 02:08:51 -0000      2.34.2.9
  +++ rpm/rpmio/rpmgc.c 9 Sep 2014 17:12:07 -0000       2.34.2.10
  @@ -285,6 +285,8 @@
   dig->pubkey_algoN = pgpPubkeyAlgo2Name(pubp->pubkey_algo);
   dig->hash_algoN = pgpHashAlgo2Name(sigp->hash_algo);
   
  +gc->digest = _free(gc->digest);
  +gc->digestlen = 0;
       xx = rpmDigestFinal(ctx, (void **)&gc->digest, &gc->digestlen, 0);
   
       switch (sigp->hash_algo) {
  @@ -357,6 +359,9 @@
   dig->hash_algoN = pgpHashAlgo2Name(sigp->hash_algo);
   
   assert(sigp->hash_algo == rpmDigestAlgo(ctx));
  +
  +gc->digest = _free(gc->digest);
  +gc->digestlen = 0;
       xx = rpmDigestFinal(ctx, (void **)&gc->digest, &gc->digestlen, 0);
   
       /* Set DSA hash. */
  @@ -399,6 +404,9 @@
   dig->hash_algoN = pgpHashAlgo2Name(sigp->hash_algo);
   
   assert(sigp->hash_algo == rpmDigestAlgo(ctx));
  +
  +gc->digest = _free(gc->digest);
  +gc->digestlen = 0;
       xx = rpmDigestFinal(ctx, (void **)&gc->digest, &gc->digestlen, 0);
   
       /* Set ELG hash. */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmgit.c
  ============================================================================
  $ cvs diff -u -r2.1.2.48 -r2.1.2.49 rpmgit.c
  --- rpm/rpmio/rpmgit.c        13 Aug 2014 17:42:08 -0000      2.1.2.48
  +++ rpm/rpmio/rpmgit.c        9 Sep 2014 17:12:07 -0000       2.1.2.49
  @@ -415,6 +415,8 @@
       int xx;
   
       if (H == NULL) {
  +     if (git->H)                     /* XXX lazy free? */
  +         git_commit_free(git->H);
        xx = chkgit(git, "git_repository_head",
                git_repository_head((git_reference **)&git->H, git->R));
        H = git->H;
  @@ -610,6 +612,8 @@
                git_commit_tree((git_tree **)&git->T, git->C));
   
   exit:
  +    if (old_head)
  +     git_commit_free(old_head);
       if (Cauthor)
        git_signature_free((git_signature *)Cauthor);
       if (Ccmtter)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsx.c
  ============================================================================
  $ cvs diff -u -r2.4.4.3 -r2.4.4.4 rpmsx.c
  --- rpm/rpmio/rpmsx.c 5 Sep 2014 19:36:29 -0000       2.4.4.3
  +++ rpm/rpmio/rpmsx.c 9 Sep 2014 17:12:08 -0000       2.4.4.4
  @@ -126,15 +126,15 @@
       }
   #endif
   
  -    /* Already initialized? */
  -    if (sx->fn) {
  -     /* If already opened, add a new reference and return. */
  -     if (!strcmp(sx->fn, fn))        /* XXX chroot by stat(fn) inode */
  -         goto exit;
  -     /* Otherwise do an implicit matchpathcon_fini(). */
  -     rpmsxFini(sx);
  +    /* If already opened, add a new reference and return. */
  +    if (sx->fn && !strcmp(sx->fn, fn)) {     /* XXX chroot by stat(fn) inode 
*/
  +     fn = _free(fn);
  +     goto exit;
       }
   
  +    /* Otherwise do an implicit matchpathcon_fini(). */
  +    rpmsxFini(sx);
  +
       sx->fn = fn;
       sx->flags = flags;
   
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to