Free vp on error
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Feb 2013 02:15:49 +0000 (21:15 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 17 Feb 2013 15:44:05 +0000 (10:44 -0500)
Closes Coverity #982097

src/lib/dhcp.c

index d5422f7..1b38d80 100644 (file)
@@ -977,7 +977,10 @@ static VALUE_PAIR *fr_dhcp_vp2suboption(VALUE_PAIR *vps)
 
                length = fr_dhcp_vp2attr(vp, ptr + 2,
                                         tlv->vp_tlv + tlv->length - ptr);
-               if (length > 255) return NULL;
+               if (length > 255) {
+                       pairfree(&vp);
+                       return NULL;
+               }
 
                /*
                 *      Pack the attribute.