lldp: fix uninitialized cleanup var
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 31 Dec 2014 15:04:55 +0000 (16:04 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 31 Dec 2014 15:04:55 +0000 (16:04 +0100)
Make sure to set _cleanup_ variables to NULL. Otherwise, we free
uninitialized objects.

src/libsystemd-network/lldp-internal.c

index f86c11e..d03445b 100644 (file)
@@ -443,7 +443,7 @@ void lldp_neighbour_port_free(lldp_neighbour_port *p) {
 int lldp_neighbour_port_new(lldp_chassis *c,
                             tlv_packet *tlv,
                             lldp_neighbour_port **ret) {
-        _cleanup_lldp_neighbour_port_free_ lldp_neighbour_port *p;
+        _cleanup_lldp_neighbour_port_free_ lldp_neighbour_port *p = NULL;
         uint16_t length, ttl;
         uint8_t *data;
         uint8_t type;