pdf problem
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | pdf problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3981@lists.php.net to get a copy of this message | ||
Uwe, I think we have another pdflib problem.
Using the current CVS compiled with --enable-debug to get Zeev's memory
debugging stuff enabled (weird place for the segfault here), I get the
following seg fault:
Program received signal SIGSEGV, Segmentation fault.
0x6569c in _mem_block_check (ptr=0x5a5a5a00, silent=1, filename=0x0, lineno=158) at alloc.c:384
384 {
(gdb) bt
#0 0x6569c in _mem_block_check (ptr=0x5a5a5a00, silent=1, filename=0x0, lineno=158) at alloc.c:384
#1 0x651b8 in _efree (ptr=0x5a5a5a00, filename=0x173b80 "functions/pdf.c", lineno=158) at
alloc.c:155
#2 0x99488 in _free_pdf_info (info=0x298390) at functions/pdf.c:158
#3 0x65be4 in list_entry_destructor (ptr=0x2983e0) at list.c:99
#4 0x5e26c in _php3_hash_destroy (ht=0x223df8) at php3_hash.c:637
#5 0xa1180 in destroy_resource_list () at ./language-parser.y:156
#6 0x5b6ec in php3_request_shutdown (dummy=0x0) at main.c:767
#7 0xb2ab4 in run_cleanups ()
#8 0xb0234 in ap_clear_pool ()
#9 0xb02c4 in ap_destroy_pool ()
#10 0xc6f34 in child_main ()
#11 0xc7118 in make_child ()
#12 0xc7314 in startup_children ()
#13 0xc7be8 in standalone_main ()
#14 0xc8758 in main ()
Looking at line 158 of pdf.c we have:
if(info->Title) efree(info->Title);
The problem is that when PDF_close() is called earlier it calls
pdf_finalize() which has this code:
PDF_free((void *)p->info);
And PDF_free() is just a regular free() call. So, the info pointer has
been freed by the time we try to efree the individual estrdup'ed strings
associated with this pointer.
How do you want to approach solving this? We could keep our own internal
struct here and keep a copy of those estrdup'ed pointers. The way pdflib
is written, I don't know how the author thinks people are supposed to
avoid memory leaks here. The way he blows away the info pointer doesn't
give anybody any chance to free the underlying element memory.
I am trying to get 3.0.7 close to release-state, so let me know when/if
you have time to look into this. If not, I'll try to fix it.
-Rasmus
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net