diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-07-26 10:37:22 -0500 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 17:00:07 -0700 |
commit | bdcb8fe195ed386599a879961d6654a46266d3b2 (patch) | |
tree | bc26b9bb3c10b0ba2f2c2b8d5a38d457b76a4441 | |
parent | 8957e148f22062833af9d19bb3488b8e444b8165 (diff) | |
download | ds-bdcb8fe195ed386599a879961d6654a46266d3b2.tar.gz ds-bdcb8fe195ed386599a879961d6654a46266d3b2.tar.xz ds-bdcb8fe195ed386599a879961d6654a46266d3b2.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 12073, 12074.
description: normalize_path() has been modified so that resources are released properly.
-rw-r--r-- | ldap/servers/slapd/util.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c index fccee11c..c4397c72 100644 --- a/ldap/servers/slapd/util.c +++ b/ldap/servers/slapd/util.c @@ -535,9 +535,9 @@ normalize_path(char *path) { char *dname = NULL; char *dnamep = NULL; - char **dirs = (char **)slapi_ch_calloc(strlen(path), sizeof(char *)); - char **rdirs = (char **)slapi_ch_calloc(strlen(path), sizeof(char *)); - char **dp = dirs; + char **dirs = NULL; + char **rdirs = NULL; + char **dp = NULL; char **rdp; int elimdots = 0; @@ -545,6 +545,10 @@ normalize_path(char *path) return NULL; } + dirs = (char **)slapi_ch_calloc(strlen(path), sizeof(char *)); + rdirs = (char **)slapi_ch_calloc(strlen(path), sizeof(char *)); + + dp = dirs; dname = slapi_ch_strdup(path); do { dnamep = strrchr(dname, _CSEP); |