freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] anuj-distance-field 05702cc 50/95: * src/sdf/ftsdf.c (sdf_ge


From: Anuj Verma
Subject: [freetype2] anuj-distance-field 05702cc 50/95: * src/sdf/ftsdf.c (sdf_generate_coarse_grid): Memory leak.
Date: Sun, 2 Aug 2020 01:10:34 -0400 (EDT)

branch: anuj-distance-field
commit 05702ccc2990453c1035c9593f24cd8eecab92b2
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Anuj Verma <anujv@iitbhilai.ac.in>

    * src/sdf/ftsdf.c (sdf_generate_coarse_grid): Memory leak.
    
    Release the allocated lists for the coarse grid after
    we are done using them.
---
 [GSoC]ChangeLog |  7 +++++++
 src/sdf/ftsdf.c | 20 +++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index 713eada..e8696d1 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,5 +1,12 @@
 2020-07-11  Anuj Verma  <anujv@iitbhilai.ac.in>
 
+       * src/sdf/ftsdf.c (sdf_generate_coarse_grid): Memory leak.
+
+       Release the allocated lists for the coarse grid after
+       we are done using them.
+
+2020-07-11  Anuj Verma  <anujv@iitbhilai.ac.in>
+
        [sdf] Completed the coarse grid optimization.
 
        * src/sdf/ftsdf.c (sdf_generate_coarse_grid): Fixed
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index f8ae7b2..844d63b 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -45,7 +45,7 @@
   /* then they will be checked for corner if they have ambiguity.         */
   #define CORNER_CHECK_EPSILON   32
 
-  #define CG_DIMEN               10
+  #define CG_DIMEN               8
 
   /**************************************************************************
    *
@@ -2909,6 +2909,24 @@
       }
     }
 
+    /* release the allocated lists */
+    for ( i = 0; i < CG_DIMEN * CG_DIMEN; i++ )
+    {
+      SDF_Edge*  edge = coarse_grid[i];
+      SDF_Edge*  temp;
+
+
+      while ( edge )
+      {
+        temp = edge;
+        edge = edge->next;
+
+        sdf_edge_done( memory, &temp );
+      }
+
+      coarse_grid[i] = NULL;
+    }
+
   Exit:
     return error;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]