FreeRADIUS/freeradius-server — pull request #795 by spbnick (2014-09-17 06:08:44+00:00)
Title: dhcp: Free unused unknown dict attrs

Free unused unknown dict attrs not attached to value pairs in
fr_dhcp_decode_suboption.

Coverity has reported the following error for this issue.

Error: RESOURCE_LEAK (CWE-772):
freeradius-server-3.0.4/src/modules/proto_dhcp/dhcp.c:731: alloc_fn: Storage is returned from allocation function "dict_attrunknown(unsigned int, unsigned int, int)".
freeradius-server-3.0.4/src/lib/dict.c:2666:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
freeradius-server-3.0.4/src/lib/dict.c:2666:2: var_assign: Assigning: "da" = "malloc(148UL)".
freeradius-server-3.0.4/src/lib/dict.c:2671:2: noescape: Resource "da" is not freed or pointed-to in function "memset(void *, int, size_t)".
freeradius-server-3.0.4/src/lib/dict.c:2687:2: var_assign: Assigning: "p" = "da".
freeradius-server-3.0.4/src/lib/dict.c:2689:2: noescape: Resource "p" is not freed or pointed-to in function "snprintf(char * restrict, size_t, char const * restrict, ...)".
freeradius-server-3.0.4/src/lib/dict.c:2712:3: noescape: Resource "p" is not freed or pointed-to in function "snprintf(char * restrict, size_t, char const * restrict, ...)".
freeradius-server-3.0.4/src/lib/dict.c:2718:2: noescape: Resource "p" is not freed or pointed-to in function "print_attr_oid(char *, size_t, unsigned int, int)".
freeradius-server-3.0.4/src/lib/dict.c:2546:36: noescape: "print_attr_oid(char *, size_t, unsigned int, int)" does not free or save its pointer parameter "buffer".
freeradius-server-3.0.4/src/lib/dict.c:2720:2: return_alloc: Returning allocated memory "da".
freeradius-server-3.0.4/src/modules/proto_dhcp/dhcp.c:731: var_assign: Assigning: "da" = storage returned from "dict_attrunknown(attr, (*tlv)->da->vendor, 1)".
freeradius-server-3.0.4/src/modules/proto_dhcp/dhcp.c:740: noescape: Resource "da" is not freed or pointed-to in function "fr_dhcp_array_members(size_t *, DICT_ATTR const *)".
freeradius-server-3.0.4/src/modules/proto_dhcp/dhcp.c:467:64: noescape: "fr_dhcp_array_members(size_t *, DICT_ATTR const *)" does not free or save its pointer parameter "da".
freeradius-server-3.0.4/src/modules/proto_dhcp/dhcp.c:758: leaked_storage: Variable "da" going out of scope leaks the storage it points to.