chiark / gitweb /
terminal/sysview: introduce SETTLE events
[elogind.git] / src / libsystemd-network / test-lldp.c
index f81284e2a7572cd2c78e47d3d7dbdb55a5f72539..06545aee59e56cae67c9aaafe77e04a2c1d4d202 100644 (file)
 ***/
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/socket.h>
-#include <linux/if.h>
-#include <linux/if_ether.h>
 #include <net/ethernet.h>
-#include <sys/types.h>
 #include <arpa/inet.h>
 
 #include "macro.h"
@@ -131,7 +126,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 +154,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 +172,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);