Commit 3eb6f66a37c2c6aa34bbd30eec2c9d1eb50b1ddb

Werner Lemberg 2016-03-01T07:10:30

[autofit] Fix reallocation error introduced in 2016-02-27 (#47310). * src/autofit/aflatin.c (af_latin_hints_compute_segments): Reassign `prev_segment' after reallocation.

diff --git a/ChangeLog b/ChangeLog
index eb556d2..c0b20b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2016-03-01  Werner Lemberg  <wl@gnu.org>
 
+	[autofit] Fix reallocation error introduced in 2016-02-27 (#47310).
+
+	* src/autofit/aflatin.c (af_latin_hints_compute_segments): Reassign
+	`prev_segment' after reallocation.
+
+2016-03-01  Werner Lemberg  <wl@gnu.org>
+
 	Fix clang warnings.
 
 	* src/autofit/aflatin.c (af_latin_hints_compute_segments): Use
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index ff0954c..e9fb9df 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1701,6 +1701,11 @@
           segment->first = point;
           segment->last  = point;
 
+          /* `af_axis_hints_new_segment' reallocates memory,    */
+          /* thus we have to refresh the `prev_segment' pointer */
+          if ( prev_segment )
+            prev_segment = segment - 1;
+
           min_pos   = max_pos   = point->u;
           min_coord = max_coord = point->v;
           min_flags = max_flags = point->flags;