Print this page
NEX-2985 libtopo leaks
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>

@@ -219,11 +219,11 @@
 char *
 pci_slot_label_lookup(topo_mod_t *mod, tnode_t *node, did_t *dp, did_t *pdp)
 {
         tnode_t *anode, *apnode;
         did_t *adp, *apdp;
-        char *plat, *pp, *l, *ancestor_l = NULL, *new_l = NULL;
+        char *plat, *pp, *l = NULL, *ancestor_l = NULL, *new_l = NULL;
         int err, b, d, f, done = 0;
         size_t len;
 
         did_BDF(dp, &b, &d, &f);
 

@@ -395,10 +395,13 @@
                                     pci_label_missing_lookup(mod, pp, dp);
                         }
                 }
                 topo_mod_strfree(mod, plat);
         }
+        if (ancestor_l != NULL) {
+                topo_mod_strfree(mod, ancestor_l);
+        }
 
         /*
          * If we calculated a slot label,  then save it in the
          * node's data structure so we can free it later.
          */