summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGünther Deschner <gdeschner@redhat.com>2013-05-15 10:37:10 +0200
committerGünther Deschner <gd@samba.org>2013-05-15 13:34:46 +0200
commitd6f07e3af3893ab2a8ad72a141b0b3e667df493e (patch)
tree60d3b3207513b096aa051c960c8135df1a78adce
parentdcf51c7a3fb148ff73b28bc48cac42ef71a4ae8c (diff)
downloadgss-proxy-d6f07e3af3893ab2a8ad72a141b0b3e667df493e.tar.gz
gss-proxy-d6f07e3af3893ab2a8ad72a141b0b3e667df493e.tar.xz
gss-proxy-d6f07e3af3893ab2a8ad72a141b0b3e667df493e.zip
Use counter when freeing cred_store configuration.
Signed-off-by: Günther Deschner <gdeschner@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
-rw-r--r--proxy/src/gp_config.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
index a906128..8be669a 100644
--- a/proxy/src/gp_config.c
+++ b/proxy/src/gp_config.c
@@ -31,7 +31,7 @@
#include "gp_proxy.h"
#include "gp_config.h"
-static void free_str_array(const char ***a)
+static void free_str_array(const char ***a, int *count)
{
const char **array = *a;
int i;
@@ -39,8 +39,14 @@ static void free_str_array(const char ***a)
if (!a) {
return;
}
- for (i = 0; array[i]; i++) {
- safefree(array[i]);
+ if (count) {
+ for (i = 0; i < *count; i++) {
+ safefree(array[i]);
+ }
+ } else {
+ for (i = 0; array[i]; i++) {
+ safefree(array[i]);
+ }
}
safefree(*a);
}
@@ -50,7 +56,8 @@ static void gp_service_free(struct gp_service *svc)
free(svc->name);
if (svc->mechs & GP_CRED_KRB5) {
free(svc->krb5.principal);
- free_str_array(&(svc->krb5.cred_store));
+ free_str_array(&(svc->krb5.cred_store),
+ &svc->krb5.cred_count);
}
gp_free_creds_handle(&svc->creds_handle);
memset(svc, 0, sizeof(struct gp_service));