Fix a memory leak in gss_release_oid_set

This commit is contained in:
dfr 2016-01-04 17:42:12 +00:00
parent 004edd0a57
commit df4e91dca3

View File

@ -32,15 +32,25 @@
OM_uint32 OM_uint32
gss_release_oid_set(OM_uint32 *minor_status, 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; *minor_status = 0;
if (set && *set) { if (setp) {
if ((*set)->elements) set = *setp;
free((*set)->elements); if (set) {
free(*set); for (i = 0; i < set->count; i++) {
*set = GSS_C_NO_OID_SET; 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); return (GSS_S_COMPLETE);
} }