Valgrinding apple trailers plugin



	While valgrinding apple trailers pluging, I found this:

==1700== Invalid read of size 4
==1700==    at 0x10C17F69: send_movie_info (grl-apple-trailers.c:274)
==1700==    by 0x76A790D: g_main_context_dispatch (gmain.c:1960)
==1700==    by 0x76AB2C7: g_main_context_iterate (gmain.c:2591)
==1700==    by 0x76AB724: g_main_loop_run (gmain.c:2799)
==1700==    by 0x5381286: gtk_main (gtkmain.c:1218)
==1700==    by 0x4074FD: main (main.c:1525)
==1700==  Address 0xf994d54 is 36 bytes inside a block of size 64 free'd
==1700==    at 0x4C21DBC: free (vg_replace_malloc.c:325)
==1700==    by 0x793AAF7: free_browse_operation_spec
(grl-media-source.c:402)
==1700==    by 0x793B618: browse_result_relay_cb
(grl-media-source.c:740)
==1700==    by 0x10C17F4D: send_movie_info (grl-apple-trailers.c:267)
==1700==    by 0x76A790D: g_main_context_dispatch (gmain.c:1960)
==1700==    by 0x76AB2C7: g_main_context_iterate (gmain.c:2591)
==1700==    by 0x76AB724: g_main_loop_run (gmain.c:2799)
==1700==    by 0x5381286: gtk_main (gtkmain.c:1218)
==1700==    by 0x4074FD: main (main.c:1525)

and it seems we are accesing a structure freed in the callback. As I
guessed the structure was being freed when the last element was returned
I wrote this small patch. Take a look at it as you know better than me
the how those calls work.

Br.

-- 
Xabier Rodríguez Calvar
Enxeñeiro en Informática
IGALIA http://www.igalia.com
From 2b227218b8e76324f971740c3f4ded51bc0fb134 Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Fri, 23 Apr 2010 12:13:34 +0200
Subject: [PATCH] [apple-trailers] Solved memory problem when decreasing pending count

---
 src/apple-trailers/grl-apple-trailers.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
index 37afc4d..d183e91 100644
--- a/src/apple-trailers/grl-apple-trailers.c
+++ b/src/apple-trailers/grl-apple-trailers.c
@@ -271,7 +271,8 @@ send_movie_info (OperationData *op_data)
                            op_data->bs->user_data,
                            NULL);
     op_data->xml_entries = op_data->xml_entries->next;
-    op_data->bs->count--;
+    if (!last)
+      op_data->bs->count--;
   }
 
   if (last) {
-- 
1.7.0

Attachment: signature.asc
Description: Esta =?ISO-8859-1?Q?=E9?= unha parte de mensaxe asinada dixitalmente



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