|
From: Chris F. <cd...@fo...> - 2010-08-25 16:16:16
|
Hi Adenilson, I haven't tested it with valgrind, and I'm sure there will be memory leaks without it. But I did test it in opensync, and it fixes a segfault that took me about 6 hours to find. When you call xmlCleanupParser(), it frees the type table, which may be in use by other code. Inside schema context pointers, there is a baseType pointer which points to a global list of types. These types disappear when some other code calls xmlCleanupParser(). Perhaps libgcal needs a cleanup function of its own, that the application should call when closing. i.e. the sample apps should call libgcal's cleanup function, which then calls xmlCleanupParser(). - Chris On Wed, Aug 25, 2010 at 11:51:26AM -0400, Adenilson Cavalcanti wrote: > Chris > > Thanks for sending a patch (generally I will > > Have you tested it with the client example code here (4 examples): > http://code.google.com/p/libgcal/ > > while running inside Valgrind? I'm used to test it for memory leaks... > > > Regards > > > Adenilson > > On Tue, Aug 24, 2010 at 11:41 PM, Chris Frey <cd...@fo...> wrote: > > Hi Adenilson, > > > > Could you apply this patch to libgcal-0.9.5 and release 0.9.6 soon? > > If libgcal calls xmlCleanupParser() it ends up freeing all the schema > > types internally, and if other code is using them (such as opensync and > > the xmlformat plugin), it causes a segfault. > > > > Thanks, > > - Chris > > > > > > > > Subject: [PATCH] Don't cleanup the entire libxml parser... other app code may still be using it > > > > --- > > ?src/gcal_parser.c | ? ?3 --- > > ?1 files changed, 0 insertions(+), 3 deletions(-) > > > > diff --git a/src/gcal_parser.c b/src/gcal_parser.c > > index 437d6ac..f1aa13c 100644 > > --- a/src/gcal_parser.c > > +++ b/src/gcal_parser.c > > @@ -103,7 +103,6 @@ int get_the_url(char *data, int length, char **url) > > ? ? ? ? ? ? ? ?result = 0; > > > > ? ? ? ?xmlFreeDoc(doc); > > - ? ? ? xmlCleanupParser(); > > > > ?exit: > > ? ? ? ?return result; > > @@ -160,7 +159,6 @@ int get_edit_url(char *data, int length, char **url) > > ? ? ? ? ? ? ? ?result = 0; > > > > ? ? ? ?xmlFreeDoc(doc); > > - ? ? ? xmlCleanupParser(); > > > > ?exit: > > ? ? ? ?return result; > > @@ -183,7 +181,6 @@ int get_edit_etag(char *data, int length, char **url) > > ? ? ? ? ? ? ? ?result = 0; > > > > ? ? ? ?xmlFreeDoc(doc); > > - ? ? ? xmlCleanupParser(); > > > > ?exit: > > ? ? ? ?return result; > > -- > > 1.7.0.3 > > > > > > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Opensync-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensync-devel |