amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone
Blob Blame History Raw
From 3c605035eff49e603c8e4a4c0886499913924529 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Wed, 24 Jan 2018 14:24:08 -0500
Subject: [PATCH] Ticket 49534 - Fix coverity regression

Description:  In automembers plugin a free was in the wrong spot
              which later led to a double free for the "rule".

https://pagure.io/389-ds-base/issue/49534

Reviewed by: mreynolds (one line commit rule)

(cherry picked from commit b3768e602fdfc2ea1fc645b17ad61c8592ab87fa)
---
 ldap/servers/plugins/automember/automember.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
index cbd25915a..c91aa4e8e 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -1117,11 +1117,11 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
                             break;
                         }
                     }
+                    automember_free_regex_rule(rule);
                 } else {
                     /* Add to head of list */
                     PR_INSERT_LINK(&(rule->list), (PRCList *)config->exclusive_rules);
                 }
-                automember_free_regex_rule(rule);
             } else {
                 slapi_log_err(SLAPI_LOG_ERR, AUTOMEMBER_PLUGIN_SUBSYSTEM,
                               "automember_parse_regex_entry - Skipping invalid exclusive "
-- 
2.13.6