summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/lldp-internal.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-06-21 20:27:04 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-10-02 17:11:40 +0200
commit2212d76d08f3bc34c683aed1a6736325b841625c (patch)
tree15d61c2c8ad6f0eb807df35c7ee182dd859ee575 /src/libsystemd-network/lldp-internal.c
parent3c2f5a543de9cc3d958920b3bd18dc8657dc201f (diff)
lldp: add reference counter to struct tlv_packet
Add a reference counter to the tlv_packet structure so that it can be shared between multiple users and properly free'd when no longer in use.
Diffstat (limited to 'src/libsystemd-network/lldp-internal.c')
-rw-r--r--src/libsystemd-network/lldp-internal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd-network/lldp-internal.c b/src/libsystemd-network/lldp-internal.c
index 3c04898e92..2906b5a4b6 100644
--- a/src/libsystemd-network/lldp-internal.c
+++ b/src/libsystemd-network/lldp-internal.c
@@ -259,7 +259,7 @@ int lldp_mib_update_objects(lldp_chassis *c, tlv_packet *tlv) {
p->until = ttl * USEC_PER_SEC + now(clock_boottime_or_monotonic());
- tlv_packet_free(p->packet);
+ tlv_packet_unref(p->packet);
p->packet = tlv;
prioq_reshuffle(p->c->by_expiry, p, &p->prioq_idx);
@@ -401,7 +401,7 @@ int lldp_mib_add_objects(Prioq *by_expiry,
return 0;
drop:
- tlv_packet_free(tlv);
+ tlv_packet_unref(tlv);
if (new_chassis)
hashmap_remove(neighbour_mib, &c->chassis_id);
@@ -435,7 +435,7 @@ void lldp_neighbour_port_free(lldp_neighbour_port *p) {
if(!p)
return;
- tlv_packet_free(p->packet);
+ tlv_packet_unref(p->packet);
free(p->data);
free(p);