aboutsummaryrefslogtreecommitdiff
path: root/lib/libgssapi/gss_release_oid_set.c
diff options
context:
space:
mode:
authorDoug Rabson <dfr@FreeBSD.org>2016-01-04 17:42:12 +0000
committerDoug Rabson <dfr@FreeBSD.org>2016-01-04 17:42:12 +0000
commit4c3117aa02d58ffbf9e9e08fd8eddec88b8989c5 (patch)
treef182f87b79490aa3a3339d934d55a8d96063f803 /lib/libgssapi/gss_release_oid_set.c
parente971a314252cbcd9cfcc1298b6f1be004cdd17e5 (diff)
downloadsrc-4c3117aa02d58ffbf9e9e08fd8eddec88b8989c5.tar.gz
src-4c3117aa02d58ffbf9e9e08fd8eddec88b8989c5.zip
Fix a memory leak in gss_release_oid_set
Notes
Notes: svn path=/head/; revision=293168
Diffstat (limited to 'lib/libgssapi/gss_release_oid_set.c')
-rw-r--r--lib/libgssapi/gss_release_oid_set.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/libgssapi/gss_release_oid_set.c b/lib/libgssapi/gss_release_oid_set.c
index bedb90ba8439..a46853a4a0d8 100644
--- a/lib/libgssapi/gss_release_oid_set.c
+++ b/lib/libgssapi/gss_release_oid_set.c
@@ -32,15 +32,25 @@
OM_uint32
gss_release_oid_set(OM_uint32 *minor_status,
- gss_OID_set *set)
+ gss_OID_set *setp)
{
+ gss_OID_set set;
+ gss_OID o;
+ size_t i;
*minor_status = 0;
- if (set && *set) {
- if ((*set)->elements)
- free((*set)->elements);
- free(*set);
- *set = GSS_C_NO_OID_SET;
+ if (setp) {
+ set = *setp;
+ if (set) {
+ for (i = 0; i < set->count; i++) {
+ o = &set->elements[i];
+ if (o->elements)
+ free(o->elements);
+ }
+ free(set->elements);
+ free(set);
+ *setp = GSS_C_NO_OID_SET;
+ }
}
return (GSS_S_COMPLETE);
}