Date: Tue, 21 May 2019 12:34:19 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 238020] Memory leak in function gss_release_oid_set in crypto/heimdal/lib/gssapi/mech/gss_release_oid_set.c Message-ID: <bug-238020-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238020 Bug ID: 238020 Summary: Memory leak in function gss_release_oid_set in crypto/heimdal/lib/gssapi/mech/gss_release_oid_set.c Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: yangx92@hotmail.com Created attachment 204507 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D204507&action= =3Dedit Proposed patch There is a memory leak in gss_release_oid_set in crypto/heimdal/lib/gssapi/mech/gss_release_oid_set.c GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_oid_set(OM_uint32 *minor_status, gss_OID_set *set) { *minor_status =3D 0; if (set && *set) { if ((*set)->elements) free((*set)->elements); free(*set); *set =3D GSS_C_NO_OID_SET; } return (GSS_S_COMPLETE); } typedef struct gss_OID_desc_struct { OM_uint32 length; void *elements; } gss_OID_desc, *gss_OID; typedef const gss_OID_desc * gss_const_OID; typedef struct gss_OID_set_desc_struct { size_t count; gss_OID elements; } gss_OID_set_desc, *gss_OID_set; Since set is the pointer that points to gss_OID_set, then *set is the point= er that points to gss_OID_set_desc. There are two elements in the struct named count and elements. And elements is the pointer that points to gss_OID_desc. There are two elements named length and *elements. Therefore, we should free all elements in gss_OID_desc. set -> gss_OID_set -> gss_OID_set_desc |count | |elements| -> gss_OID_desc | length = | | *elemen= ts | The attachment is the proposed patch. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238020-227>