This is an automated email from the git hooks/post-receive script.
simo pushed a commit to branch master
in repository gssproxy.
commit 4c2925d2aa0b7256b53eb61ef072c4685f728bd2
Author: Robbie Harwood <rharwood(a)redhat.com>
Date: Tue Sep 27 20:50:59 2016 +0000
Fix two leaks in gp_get_cred_environment()
Signed-off-by: Robbie Harwood <rharwood(a)redhat.com>
Reviewed-by: Simo Sorce <simo(a)redhat.com>
---
proxy/src/gp_creds.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c
index 446c7d8..8280ef2 100644
--- a/proxy/src/gp_creds.c
+++ b/proxy/src/gp_creds.c
@@ -248,7 +248,7 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall,
int ret = -1;
int k_num = -1;
int ck_num = -1;
- int c, d;
+ int d;
memset(cs, 0, sizeof(gss_key_value_set_desc));
@@ -354,7 +354,6 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall,
ret = ENOMEM;
goto done;
}
- c = 0;
for (d = 0; d < svc->krb5.cred_count; d++) {
p = strchr(svc->krb5.cred_store[d], ':');
if (!p) {
@@ -366,9 +365,9 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall,
}
if (strncmp(svc->krb5.cred_store[d], "client_keytab:", 14) == 0) {
- ck_num = c;
+ ck_num = cs->count;
} else if (strncmp(svc->krb5.cred_store[d], "keytab:", 7) == 0) {
- k_num = c;
+ k_num = cs->count;
}
ret = asprintf(&str, "%.*s", (int)(p -
svc->krb5.cred_store[d]),
@@ -377,19 +376,20 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall,
ret = ENOMEM;
goto done;
}
- cs->elements[c].key = str;
+ cs->elements[cs->count].key = str;
fmtstr = p + 1;
- cs->elements[c].value = get_formatted_string(fmtstr, target_uid);
- if (!cs->elements[c].value) {
+ cs->elements[cs->count].value =
+ get_formatted_string(fmtstr, target_uid);
+ if (!cs->elements[cs->count].value) {
+ safefree(str);
GPDEBUG("Failed to build credential store formatted string.\n");
ret = ENOMEM;
goto done;
}
- c++;
+ cs->count++;
}
- cs->count = c;
/* when a user is not explicitly requested then it means the calling
* application wants to use the credentials in the standard keytab,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.