]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Don't free statically allocated port.
authorVincent Bernat <bernat@luffy.cx>
Tue, 2 Jun 2009 08:57:15 +0000 (10:57 +0200)
committerVincent Bernat <bernat@luffy.cx>
Tue, 2 Jun 2009 08:57:15 +0000 (10:57 +0200)
src/cdp.c
src/edp.c
src/lldp.c
src/lldpd.c
src/sonmp.c

index e3c18ffafffe505a9901b77dc0f148bd56a79b70..0f3df5c51386f9be6b66a4adadbcf235068a1ad9 100644 (file)
--- a/src/cdp.c
+++ b/src/cdp.c
@@ -466,6 +466,7 @@ cdp_decode(struct lldpd *cfg, char *frame, int s,
 malformed:
        lldpd_chassis_cleanup(chassis, 1);
        lldpd_port_cleanup(port, 1);
+       free(port);
        return -1;
 }
 
index b9197ed36f1e10f55ac8896565d082131d090d8e..7a628b9dfacfd4b537fb1a11beeba3f63d59ee4c 100644 (file)
--- a/src/edp.c
+++ b/src/edp.c
@@ -483,6 +483,7 @@ edp_decode(struct lldpd *cfg, char *frame, int s,
 malformed:
        lldpd_chassis_cleanup(chassis, 1);
        lldpd_port_cleanup(port, 1);
+       free(port);
        return -1;
 }
 
index 5aa9deee25d286435cf788a01eef3e28ab43a1db..3fd564722ca17fc68fed76f51b3861d1eb337380 100644 (file)
@@ -784,5 +784,6 @@ lldp_decode(struct lldpd *cfg, char *frame, int s,
 malformed:
        lldpd_chassis_cleanup(chassis, 1);
        lldpd_port_cleanup(port, 1);
+       free(port);
        return -1;
 }
index ee3ce70da3cefb950b044cf24a0fefe30ad9aaad..16c757bc33fd9bf70ba9edfeff7e06b15fb8a244 100644 (file)
@@ -150,8 +150,7 @@ lldpd_vlan_cleanup(struct lldpd_port *port)
 #endif
 
 /* If `all' is true, clear all information, including information that
-   are not refreshed periodically. If `all' is true, also free the
-   port. */
+   are not refreshed periodically. Port should be freed manually. */
 void
 lldpd_port_cleanup(struct lldpd_port *port, int all)
 {
@@ -170,7 +169,6 @@ lldpd_port_cleanup(struct lldpd_port *port, int all)
                free(port->p_lastframe);
                if (port->p_chassis) /* chassis may not have been attributed, yet */
                        port->p_chassis->c_refcount--;
-               free(port);
        }
 }
 
@@ -211,6 +209,7 @@ lldpd_remote_cleanup(struct lldpd *cfg, struct lldpd_hardware *hardware, int all
                if (del) {
                        TAILQ_REMOVE(&hardware->h_rports, port, p_entries);
                        lldpd_port_cleanup(port, 1);
+                       free(port);
                }
        }
 }
@@ -344,6 +343,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
                /* The port is known, remove it before adding it back */
                TAILQ_REMOVE(&hardware->h_rports, oport, p_entries);
                lldpd_port_cleanup(oport, 1);
+               free(oport);
        }
        if (ochassis) {
                lldpd_update_chassis(ochassis, chassis);
index cb201fb19101a8a05b1aebd4d37cf5ceb3a3a89d..ed09c77d9c875edf910f6ebe0a07d5883f7717ea 100644 (file)
@@ -378,6 +378,7 @@ sonmp_decode(struct lldpd *cfg, char *frame, int s,
 malformed:
        lldpd_chassis_cleanup(chassis, 1);
        lldpd_port_cleanup(port, 1);
+       free(port);
        return -1;
 }