zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

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

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