+1

于 2012-6-19 23:35, Eduardo Lima (Etrunko) 写道:
From: "Eduardo Lima (Etrunko)"<[email protected]>

The list pointer was leaking in the case where the list was empty.

Signed-off-by: Eduardo Lima (Etrunko)<[email protected]>
---
  libxkutil/list_util.c |    6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libxkutil/list_util.c b/libxkutil/list_util.c
index 84b2ba0..cab0287 100644
--- a/libxkutil/list_util.c
+++ b/libxkutil/list_util.c
@@ -54,9 +54,12 @@ void list_free(list_t *list)
  {
          list_node_t *n, *next;

-        if (list == NULL || list->head == NULL)
+        if (list == NULL)
                  return;

+        if (list->head == NULL)
+                goto end;
+
          n = list->head;

          do {
@@ -68,6 +71,7 @@ void list_free(list_t *list)
                  n = next;
          } while (n != list->head);

+ end:
          free(list);
  }



--
Best Regards

Wayne Xia
mail:[email protected]
tel:86-010-82450803

_______________________________________________
Libvirt-cim mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvirt-cim

Reply via email to