Created attachment 83530 [details] new function gstrdup If the poppler sources are compiled with DBEUG_MEM, the gfree call gives an error message if the memory is not allocated by gmalloc. But a very few routines uses strdup to allocate and copy strings, and later use gfree to free the allocated memory, which gives an error message if compiled with DEBUG_MEM. One sample for this behaviour is Dict::Dict(Dict* dictA). The attached patch introduces the new function gstrdup and use it everywhere instead of strdup.
Created attachment 83532 [details] [review] upload it as patch intead of plain text
Makes sense, you think we should appy it to both 0.24 and master or only 0.24? Arguably "it is a bug", but only happens on "special debug mode", so i'm undecided if only master would be enough.
I think, master is sufficient. I only run into that error because I compile my window version with DEBUG_MEM with VisualC Debug settings, and I think, it's rarely used.
Actaully i just saw we have something called copyString(), should we just use that? or rename that? or kill it and move it to the new gstrdup?
(In reply to comment #4) > Actaully i just saw we have something called copyString(), should we just > use that? or rename that? or kill it and move it to the new gstrdup? Sorry, I missed the function copyString, otherwise I would have probably used it. On the other hand: having a gstrndup (instead of strndup) but a copyString (instead of strdup) is a little bit confusing, isn't it? Therefore I would vote for kill copyString (just used in Object.h) and use gstrdup instead.
You need to improve your grepping skills ;-) copyString is used in loooooooots of files, not only Object.h Since it's actually an xpdf function i'd prefer if we use that to keep merging with a future possible xpdf 3.04 easier. Do you want to upload a patch with copyString for those places or shall I?
Created attachment 83708 [details] [review] use copyString where memory is freed with gfree (In reply to comment #6) > You need to improve your grepping skills ;-) Upps, grep copyString */*.h is not the best way to find all occurences of copyString :-) > copyString is used in loooooooots of files, not only Object.h > > Since it's actually an xpdf function i'd prefer if we use that to keep > merging with a future possible xpdf 3.04 easier. > > Do you want to upload a patch with copyString for those places or shall I? Here it is. I just replace the call of strdup with copyString where the pointer is freed with gfree().
Pushed
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.