Hi,
experimenting with pdf-tokeniser I found that there are some free()
statements which cause segfaults (a couple of unitialized pointers and
one non alloc'd char array), a patch is attached. No one stumbled on
this before?


-- 
Stefano Facchini <[email protected]>
=== modified file 'utils/pdf-tokeniser.c'
--- utils/pdf-tokeniser.c	2011-08-29 18:02:05 +0000
+++ utils/pdf-tokeniser.c	2011-09-17 18:42:08 +0000
@@ -208,7 +208,9 @@
     str = fmtbin (str, strsize);
 
   printf ("%s(%s)\n", typ, str);
-  free (str);
+
+  if (str != tmpbuf)
+    free (str);
 };
 
 void
@@ -217,11 +219,11 @@
             pdf_u32_t   reader_flags,
             pdf_u32_t   writer_flags)
 {
-  pdf_token_reader_t *reader;
-  pdf_token_writer_t *writer;
+  pdf_token_reader_t *reader = NULL;
+  pdf_token_writer_t *writer = NULL;
   pdf_token_t *token;
-  pdf_stm_t *stm_in;
-  pdf_stm_t *stm_out;
+  pdf_stm_t *stm_in = NULL;
+  pdf_stm_t *stm_out = NULL;
   pdf_error_t *error = NULL;
 
   stm_in = pdf_stm_cfile_new (file,

Reply via email to