[vlc-devel] commit: libvlc: pop_listener does not do its job. (Pierre d'Herbemont )

git version control git at videolan.org
Tue Jun 9 07:35:52 CEST 2009


vlc | branch: 1.0-bugfix | Pierre d'Herbemont <pdherbemont at free.fr> | Thu Jun  4 22:32:07 2009 -0700| [8afeb01ef56395c379bc097122b1dcdfaf6c39f9] | committer: Pierre d'Herbemont 

libvlc: pop_listener does not do its job.

Pointed by Laurent and Valgrind.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8afeb01ef56395c379bc097122b1dcdfaf6c39f9
---

 src/control/event_async.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/control/event_async.c b/src/control/event_async.c
index 147e87b..e8f9a08 100644
--- a/src/control/event_async.c
+++ b/src/control/event_async.c
@@ -133,14 +133,18 @@ static void pop_listener(libvlc_event_manager_t * p_em, libvlc_event_listener_t
     while (iter) {
         if(listeners_are_equal(&iter->listener, listener))
         {
+            struct queue_elmt * to_delete = iter;
             if(!prev)
-                queue(p_em)->elements = iter->next;
+                queue(p_em)->elements = to_delete->next;
             else
-                prev->next = iter->next;
-            free(iter);
+                prev->next = to_delete->next;
+            iter = to_delete->next;
+            free(to_delete);
+        }
+        else {
+            prev = iter;
+            iter = iter->next;
         }
-        prev = iter;
-        iter = iter->next;
     }
 }
 




More information about the vlc-devel mailing list