summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-21 21:33:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-21 21:33:20 (GMT)
commitd800cb1c80ec68eb1ad85134fd9c0727023f572a (patch)
tree6fcf08b763b9f1a7b6708918085b352abe671631 /src/glibext
parentcff2f506464abf93c35feb6d644ad08b79feb856 (diff)
Fixed bugs as realloc() may change base addresses and does not initialize new memory.
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/gwidthtracker.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glibext/gwidthtracker.c b/src/glibext/gwidthtracker.c
index 10d01ab..94e7f36 100644
--- a/src/glibext/gwidthtracker.c
+++ b/src/glibext/gwidthtracker.c
@@ -518,6 +518,8 @@ void g_width_tracker_update_added(GWidthTracker *tracker, size_t index, size_t c
tracker->portions = (common_metrics *)realloc(tracker->portions,
tracker->count * sizeof(common_metrics));
+ portion = &tracker->portions[current];
+
dest = current + 2;
src = current + 1;
@@ -535,6 +537,8 @@ void g_width_tracker_update_added(GWidthTracker *tracker, size_t index, size_t c
tracker->portions[current + 1].first = portion->first + 1;
tracker->portions[current + 1].last = portion->last;
+ tracker->portions[current + 1].cached = false;
+
portion->first = i;
portion->last = i;
@@ -546,6 +550,8 @@ void g_width_tracker_update_added(GWidthTracker *tracker, size_t index, size_t c
tracker->portions[current + 1].first = i;
tracker->portions[current + 1].last = portion->last;
+ tracker->portions[current + 1].cached = false;
+
portion->last = i - 1;
}