summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2010-09-09 10:35:11 -0700
committerNathan Kinder <nkinder@redhat.com>2010-09-09 10:35:11 -0700
commit07d7c8977e783d1e9c34c25ce09f7a162a391c4a (patch)
treee91e1bbdbee08710c384e4caf0927fee6c8711aa
parentd88253df42157df3d112122c3551b0969e9ce8a0 (diff)
downloadds-07d7c8977e783d1e9c34c25ce09f7a162a391c4a.tar.gz
ds-07d7c8977e783d1e9c34c25ce09f7a162a391c4a.tar.xz
ds-07d7c8977e783d1e9c34c25ce09f7a162a391c4a.zip
Bug 630090 - (cov#15445) Fix illegal free in archive code
The directory variable points to a dynamically allocated string returned by rel2abspath(). We are changing directory to point to a string constant if we are unable to parse the directory. This not only leaks memory, but it can cause us to attempt to free the string constant. We should free the string before we overwrite it, and we should dynamically allocate a new string instead of using a string constant.
-rw-r--r--ldap/servers/slapd/back-ldbm/archive.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ldap/servers/slapd/back-ldbm/archive.c b/ldap/servers/slapd/back-ldbm/archive.c
index f048a6fc..edaa5edf 100644
--- a/ldap/servers/slapd/back-ldbm/archive.c
+++ b/ldap/servers/slapd/back-ldbm/archive.c
@@ -208,7 +208,8 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
if (NULL == p) /* never happen, I guess */
{
- directory = ".";
+ slapi_ch_free_string(&directory);
+ directory = slapi_ch_smprintf(".");
c = '/';
}
else