projects
/
trust_router.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fa3293d
)
Fix memory leak in tids.c.
author
Jennifer Richards
<jennifer@painless-security.com>
Thu, 11 Aug 2016 15:32:35 +0000
(11:32 -0400)
committer
Jennifer Richards
<jennifer@painless-security.com>
Thu, 11 Aug 2016 15:32:35 +0000
(11:32 -0400)
tid/tids.c
patch
|
blob
|
history
diff --git
a/tid/tids.c
b/tid/tids.c
index
984cb48
..
f650c40
100644
(file)
--- a/
tid/tids.c
+++ b/
tid/tids.c
@@
-51,7
+51,8
@@
static TID_RESP *tids_create_response (TIDS_INSTANCE *tids, TID_REQ *req)
{
static TID_RESP *tids_create_response (TIDS_INSTANCE *tids, TID_REQ *req)
{
- TID_RESP *resp;
+ TID_RESP *resp=NULL;
+ int success=0;
if ((NULL == (resp = talloc_zero(req, TID_RESP)))) {
tr_crit("tids_create_response: Error allocating response structure.");
if ((NULL == (resp = talloc_zero(req, TID_RESP)))) {
tr_crit("tids_create_response: Error allocating response structure.");
@@
-63,14
+64,30
@@
static TID_RESP *tids_create_response (TIDS_INSTANCE *tids, TID_REQ *req)
(NULL == (resp->realm = tr_dup_name(req->realm))) ||
(NULL == (resp->comm = tr_dup_name(req->comm)))) {
tr_crit("tids_create_response: Error allocating fields in response.");
(NULL == (resp->realm = tr_dup_name(req->realm))) ||
(NULL == (resp->comm = tr_dup_name(req->comm)))) {
tr_crit("tids_create_response: Error allocating fields in response.");
-
return NULL
;
+
goto cleanup
;
}
if (req->orig_coi) {
if (NULL == (resp->orig_coi = tr_dup_name(req->orig_coi))) {
tr_crit("tids_create_response: Error allocating fields in response.");
}
if (req->orig_coi) {
if (NULL == (resp->orig_coi = tr_dup_name(req->orig_coi))) {
tr_crit("tids_create_response: Error allocating fields in response.");
-
return NULL
;
+
goto cleanup
;
}
}
}
}
+
+ success=1;
+
+cleanup:
+ if ((!success) && (resp!=NULL)) {
+ if (resp->rp_realm!=NULL)
+ tr_free_name(resp->rp_realm);
+ if (resp->realm!=NULL)
+ tr_free_name(resp->realm);
+ if (resp->comm!=NULL)
+ tr_free_name(resp->comm);
+ if (resp->orig_coi!=NULL)
+ tr_free_name(resp->orig_coi);
+ talloc_free(resp);
+ resp=NULL;
+ }
return resp;
}
return resp;
}