diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 15:59:40 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 16:58:39 -0700 |
commit | 0329272d756e620edcc15f3084bcbb06f24c2327 (patch) | |
tree | 0e0af01bc29bf95449b430ff9c4630aee49d2ee0 /ldap/servers/plugins/replication/windows_inc_protocol.c | |
parent | 72a2c1e7699af16d9617159fe7677a33fdf7b6f8 (diff) | |
download | ds-0329272d756e620edcc15f3084bcbb06f24c2327.tar.gz ds-0329272d756e620edcc15f3084bcbb06f24c2327.tar.xz ds-0329272d756e620edcc15f3084bcbb06f24c2327.zip |
Bug 617630 - fix coverify Defect Type: Resource leaks issues CID 12052 - 12093
https://bugzilla.redhat.com/show_bug.cgi?id=617630
Resolves: bug 617630
Bug description: fix coverify Defect Type: Resource leaks issues CID 12053
description: windows_inc_delete() has been modified to stop the
replication protocol and release resources.
Diffstat (limited to 'ldap/servers/plugins/replication/windows_inc_protocol.c')
-rw-r--r-- | ldap/servers/plugins/replication/windows_inc_protocol.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c index e5e67c3b..7ff47fa5 100644 --- a/ldap/servers/plugins/replication/windows_inc_protocol.c +++ b/ldap/servers/plugins/replication/windows_inc_protocol.c @@ -161,6 +161,22 @@ windows_inc_delete(Private_Repl_Protocol **prpp) /* First, stop the protocol if it isn't already stopped */ /* Then, delete all resources used by the protocol */ slapi_eq_cancel(dirsync); + + if (!(*prpp)->stopped) { + (*prpp)->stopped = 1; + (*prpp)->stop(*prpp); + } + if ((*prpp)->lock) { + PR_DestroyLock((*prpp)->lock); + (*prpp)->lock = NULL; + } + if ((*prpp)->cvar) { + PR_DestroyCondVar((*prpp)->cvar); + (*prpp)->cvar = NULL; + } + slapi_ch_free((void **)&(*prpp)->private); + slapi_ch_free((void **)prpp); + LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_inc_delete\n" ); } @@ -1556,7 +1572,7 @@ Private_Repl_Protocol * Windows_Inc_Protocol_new(Repl_Protocol *rp) { windows_inc_private *rip = NULL; - Private_Repl_Protocol *prp = (Private_Repl_Protocol *)slapi_ch_malloc(sizeof(Private_Repl_Protocol)); + Private_Repl_Protocol *prp = (Private_Repl_Protocol *)slapi_ch_calloc(1, sizeof(Private_Repl_Protocol)); LDAPDebug0Args( LDAP_DEBUG_TRACE, "=> Windows_Inc_Protocol_new\n" ); |