changeset 10665:026530b2b10e

6874993 memory leaks in pi_get_chassisid() 6879357 fmd dumps core while processing a DR event
author Tom Pothier <Tom.Pothier@Sun.COM>
date Mon, 28 Sep 2009 08:36:10 -0400
parents e29b5b8a591c
children 48f9827bb5cf
files usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_defer.c usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c
diffstat 3 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_defer.c	Mon Sep 28 00:35:43 2009 -0700
+++ b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_defer.c	Mon Sep 28 08:36:10 2009 -0400
@@ -20,11 +20,10 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
  * Some topology creation routines may need to defer completing enumeration
@@ -46,8 +45,8 @@
 #include <fm/topo_hc.h>
 #include "pi_impl.h"
 
-static uu_list_pool_t	*defer_pool;
-static uu_list_t	*defer_list;
+static uu_list_pool_t	*defer_pool = NULL;
+static uu_list_t	*defer_list = NULL;
 
 struct pi_defernode_s {
 	uu_list_node_t	defer_node;
@@ -194,6 +193,8 @@
 
 	uu_list_destroy(defer_list);
 	uu_list_pool_destroy(defer_pool);
+	defer_list = NULL;
+	defer_pool = NULL;
 
 	return (0);
 }
@@ -213,6 +214,7 @@
 	defer_list = uu_list_create(defer_pool, NULL, 0);
 	if (defer_list == NULL) {
 		uu_list_pool_destroy(defer_pool);
+		defer_pool = NULL;
 		topo_mod_seterrno(mod, EMOD_NOMEM);
 		return (-1);
 	}
--- a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c	Mon Sep 28 00:35:43 2009 -0700
+++ b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_subr.c	Mon Sep 28 08:36:10 2009 -0400
@@ -261,6 +261,9 @@
 		topo_mod_dprintf(mod, "pi_get_chassis: chassis-id = %s\n", id);
 		return (topo_mod_strdup(mod, id));
 	}
+	if (hc_name != NULL) {
+		topo_mod_strfree(mod, hc_name);
+	}
 
 	/*
 	 * Search the PRI for nodes of type MD_STR_COMPONENT and find the
--- a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c	Mon Sep 28 00:35:43 2009 -0700
+++ b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c	Mon Sep 28 08:36:10 2009 -0400
@@ -100,8 +100,8 @@
  * single thread and a single invocation at a time for an enumerator.  This
  * makes using a file-global safe.
  */
-static uu_list_pool_t	*walker_pool;
-static uu_list_t	*walker_list;
+static uu_list_pool_t	*walker_pool = NULL;
+static uu_list_t	*walker_list = NULL;
 
 struct pi_walkernode_s {
 	uu_list_node_t	walker_node;
@@ -704,6 +704,7 @@
 	walker_list = uu_list_create(walker_pool, NULL, 0);
 	if (walker_list == NULL) {
 		uu_list_pool_destroy(walker_pool);
+		walker_pool = NULL;
 		return (-1);
 	}
 
@@ -732,6 +733,8 @@
 	}
 	uu_list_destroy(walker_list);
 	uu_list_pool_destroy(walker_pool);
+	walker_list = NULL;
+	walker_pool = NULL;
 }