Blame SOURCES/0051-Ticket-49531-coverity-issues-fix-memory-leaks.patch

081b2d
From 7acfb18228322ab2e331720bd7fe083da04625a2 Mon Sep 17 00:00:00 2001
081b2d
From: Mark Reynolds <mreynolds@redhat.com>
081b2d
Date: Fri, 12 Jan 2018 09:50:34 -0500
081b2d
Subject: [PATCH] Ticket 49531 - coverity issues - fix memory leaks
081b2d
081b2d
Description:  There were two false positives around pwpolicy struct
081b2d
              being leaked, but it is freed when the pblock is
081b2d
              destroyed.  The other two leaks were real, but they
081b2d
              only occurred during error conditions.
081b2d
081b2d
https://pagure.io/389-ds-base/issue/49531
081b2d
081b2d
Reviewed by: lkrispen (Thanks!)
081b2d
081b2d
(cherry picked from commit 700d7422e6309d2d405961abbb805fbfe852e53c)
081b2d
---
081b2d
 ldap/servers/plugins/replication/cl5_api.c | 1 +
081b2d
 ldap/servers/plugins/replication/urp.c     | 3 ++-
081b2d
 2 files changed, 3 insertions(+), 1 deletion(-)
081b2d
081b2d
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
081b2d
index dc2857910..89ae9956c 100644
081b2d
--- a/ldap/servers/plugins/replication/cl5_api.c
081b2d
+++ b/ldap/servers/plugins/replication/cl5_api.c
081b2d
@@ -4046,6 +4046,7 @@ _cl5WriteRUV(CL5DBFile *file, PRBool purge)
081b2d
         slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
081b2d
                       "_cl5WriteRUV - changelog maxRUV not found in changelog for file %s\n",
081b2d
                       file->name);
081b2d
+        ber_bvecfree(vals);
081b2d
         return CL5_DB_ERROR;
081b2d
     }
081b2d
 
081b2d
diff --git a/ldap/servers/plugins/replication/urp.c b/ldap/servers/plugins/replication/urp.c
081b2d
index 9534c0322..d4556d7fd 100644
081b2d
--- a/ldap/servers/plugins/replication/urp.c
081b2d
+++ b/ldap/servers/plugins/replication/urp.c
081b2d
@@ -861,7 +861,7 @@ urp_fixup_add_cenotaph (Slapi_PBlock *pb, char *sessionid, CSN *opcsn)
081b2d
     Slapi_Entry *pre_entry = NULL;
081b2d
     int ret = 0;
081b2d
     Slapi_DN *pre_sdn = NULL;
081b2d
-    Slapi_RDN *rdn = slapi_rdn_new();
081b2d
+    Slapi_RDN *rdn = NULL;
081b2d
     char *parentdn = NULL;
081b2d
     char *newdn;
081b2d
     const char *entrydn;
081b2d
@@ -882,6 +882,7 @@ urp_fixup_add_cenotaph (Slapi_PBlock *pb, char *sessionid, CSN *opcsn)
081b2d
        entrydn = slapi_entry_get_ndn (pre_entry);*/
081b2d
     uniqueid = slapi_entry_get_uniqueid (pre_entry);
081b2d
     parentdn = slapi_dn_parent(entrydn);
081b2d
+    rdn = slapi_rdn_new();
081b2d
     slapi_sdn_get_rdn(pre_sdn, rdn);
081b2d
     slapi_rdn_remove_attr (rdn, SLAPI_ATTR_UNIQUEID );
081b2d
     slapi_rdn_add(rdn, "cenotaphID", uniqueid);
081b2d
-- 
081b2d
2.13.6
081b2d