[Spice-devel] [PATCH 2/3] fix memory leak in error path

Christophe Fergeau cfergeau at redhat.com
Tue Aug 23 19:41:32 PDT 2011


Issue found by the Coverity scanner
---
 common/lines.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/common/lines.c b/common/lines.c
index 8731fb7..e2349e8 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -1512,7 +1512,7 @@ miZeroLine (GCPtr pGC, int mode,        /* Origin or Previous */
     pspanInit = (DDXPointRec *)xalloc (list_len * sizeof (DDXPointRec));
     pwidthInit = (int *)xalloc (list_len * sizeof (int));
     if (!pspanInit || !pwidthInit)
-        return;
+        goto out;
 
     Nspans = 0;
     new_span = TRUE;
@@ -1686,6 +1686,7 @@ miZeroLine (GCPtr pGC, int mode,        /* Origin or Previous */
     if (Nspans > 0)
         (*pGC->ops->FillSpans) (pGC, Nspans, pspanInit, pwidthInit, FALSE, TRUE);
 
+out:
     xfree (pwidthInit);
     xfree (pspanInit);
 }
-- 
1.7.6



More information about the Spice-devel mailing list