]> git.proxmox.com Git - mirror_ovs.git/blobdiff - lib/stp.c
Merge "master" into "next".
[mirror_ovs.git] / lib / stp.c
index 5d35156acb7ccef49e2be0f097fbc1a691ff4f3a..38885c07f666e472ce4691988863e7df7879e991 100644 (file)
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -216,7 +216,7 @@ stp_create(const char *name, stp_identifier bridge_id,
     struct stp *stp;
     struct stp_port *p;
 
-    stp = xcalloc(1, sizeof *stp);
+    stp = xzalloc(sizeof *stp);
     stp->name = xstrdup(name);
     stp->bridge_id = bridge_id;
     if (!(stp->bridge_id >> 48)) {
@@ -258,7 +258,10 @@ stp_create(const char *name, stp_identifier bridge_id,
 void
 stp_destroy(struct stp *stp)
 {
-    free(stp);
+    if (stp) {
+        free(stp->name);
+        free(stp);
+    }
 }
 
 /* Runs 'stp' given that 'ms' milliseconds have passed. */