[Xfce4-commits] <xfce4-settings:master> Fix free of invalid memory (bug #6909).

Nick Schermer noreply at xfce.org
Thu Dec 2 18:58:01 CET 2010


Updating branch refs/heads/master
         to 92b0b61cf7cd82861d8a7ff407b0b2b927b4151f (commit)
       from 59e414aada5bed6f9a26ea6dc704576c5db273da (commit)

commit 92b0b61cf7cd82861d8a7ff407b0b2b927b4151f
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Dec 2 18:55:48 2010 +0100

    Fix free of invalid memory (bug #6909).

 xfce4-settings-helper/pointers.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xfce4-settings-helper/pointers.c b/xfce4-settings-helper/pointers.c
index a1a352d..6e37202 100644
--- a/xfce4-settings-helper/pointers.c
+++ b/xfce4-settings-helper/pointers.c
@@ -310,7 +310,7 @@ xfce_pointers_helper_change_feedback (XDevice *device,
                                       gint     threshold,
                                       gdouble  acceleration)
 {
-    XFeedbackState      *states;
+    XFeedbackState      *states, *pt;
     gint                 num_feedbacks;
     XPtrFeedbackControl  feedback;
     gint                 n;
@@ -323,10 +323,10 @@ xfce_pointers_helper_change_feedback (XDevice *device,
     if (G_LIKELY (states))
     {
         /* get the pointer feedback class */
-        for (n = 0; n < num_feedbacks; n++)
+        for (pt = states, n = 0; n < num_feedbacks; n++)
         {
             /* find the pointer feedback class */
-            if (states->class == PtrFeedbackClass)
+            if (pt->class == PtrFeedbackClass)
             {
                 if (acceleration > 0 || acceleration == -1)
                 {
@@ -351,7 +351,7 @@ xfce_pointers_helper_change_feedback (XDevice *device,
                 /* create a new feedback */
                 feedback.class      = PtrFeedbackClass;
                 feedback.length     = sizeof (XPtrFeedbackControl);
-                feedback.id         = states->id;
+                feedback.id         = pt->id;
                 feedback.threshold  = threshold;
                 feedback.accelNum   = num;
                 feedback.accelDenom = denom;
@@ -364,7 +364,7 @@ xfce_pointers_helper_change_feedback (XDevice *device,
             }
 
             /* advance the offset */
-            states = (XFeedbackState *) ((gchar *) states + states->length);
+            pt = (XFeedbackState *) ((gchar *) pt + pt->length);
         }
 
         /* cleanup */



More information about the Xfce4-commits mailing list