File ppc64-diag.bug-931001_free_phandle_list.patch of Package ppc64-diag.636

During PRRN event handling we build a list of phandles for all the LMBs

From: Nathan Fontenot <nfont@linux.vnet.ibm.com>

on the system in order to correlate between drc indexes and their
phandle. This list is never free'ed. Failure to do so results in a list
that grows every time a PRRN event is handled.

After handling a PRRN event free the list of phandles.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 rtas_errd/prrn.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Index: ppc64-diag-2.6.7/rtas_errd/prrn.c
===================================================================
--- ppc64-diag-2.6.7.orig/rtas_errd/prrn.c
+++ ppc64-diag-2.6.7/rtas_errd/prrn.c
@@ -257,6 +257,23 @@ static int add_phandles()
 }
 
 /**
+ * free_phandles
+ *
+ */
+static void free_phandles()
+{
+	struct pmap_struct *pm;
+
+	while (plist) {
+		pm = plist;
+		plist = plist->next;
+
+		free(pm->name);
+		free(pm);
+	}
+}
+
+/**
  * do_update
  *
  * @param cmd
@@ -561,6 +578,7 @@ static void devtree_update(uint scope)
 		}
 	} while (rc == 1);
 
+	free_phandles();
 	dbg("Finished devtree update");
 }
 
openSUSE Build Service is sponsored by