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

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