chiark / gitweb /
test-lldp: fix minor OOM
authorLennart Poettering <lennart@poettering.net>
Tue, 10 Feb 2015 20:17:26 +0000 (21:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Feb 2015 20:17:26 +0000 (21:17 +0100)
src/libsystemd-network/test-lldp.c

index f81284e..ee74ebd 100644 (file)
@@ -131,7 +131,8 @@ static int lldp_parse_chassis_tlv(tlv_packet *m, uint8_t *type) {
 }
 
 static int lldp_parse_port_id_tlv(tlv_packet *m) {
-        char *str = NULL, *p;
+        _cleanup_free_ char *p = NULL;
+        char *str = NULL;
         uint16_t length;
         uint8_t subtype;
 
@@ -158,7 +159,8 @@ static int lldp_parse_port_id_tlv(tlv_packet *m) {
 }
 
 static int lldp_parse_system_name_tlv(tlv_packet *m) {
-        char *str = NULL, *p;
+        _cleanup_free_ char *p = NULL;
+        char *str = NULL;
         uint16_t length;
 
         assert_se(lldp_tlv_packet_enter_container(m, LLDP_TYPE_SYSTEM_NAME) >= 0);
@@ -175,7 +177,8 @@ static int lldp_parse_system_name_tlv(tlv_packet *m) {
 }
 
 static int lldp_parse_system_desc_tlv(tlv_packet *m) {
-        char *str = NULL, *p;
+        _cleanup_free_ char *p = NULL;
+        char *str = NULL;
         uint16_t length;
 
         assert_se(lldp_tlv_packet_enter_container(m, LLDP_TYPE_SYSTEM_DESCRIPTION) >= 0);