These showed up running under gdb with CK_FORK="no".

Please review and apply.

Brad
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email protected]\
#   h8vi60vapbj14wpw
# target_branch: http://bzr.savannah.gnu.org/r/pdf/libgnupdf/branches\
#   /trunk/
# testament_sha1: 7e2972de888dc923a4fc6ae295b74dccbd63863f
# timestamp: 2009-06-22 21:22:38 +1000
# base_revision_id: [email protected]
# 
# Begin patch
=== modified file 'AUTHORS'
--- AUTHORS	2009-06-18 12:06:04 +0000
+++ AUTHORS	2009-06-22 11:20:04 +0000
@@ -83,6 +83,7 @@
   prmgt/MANIFEST.wiki
   src/MANIFEST.wiki
   src/README
+  src/base/pdf-text.c
   src/base/pdf-time.c
   src/object/MANIFEST.wiki
   torture/MANIFEST.wiki
@@ -92,8 +93,9 @@
   torture/unit/base/crypt/pdf-crypt-md-new.c
   torture/unit/base/crypt/pdf-crypt-md-read.c
   torture/unit/base/text/pdf-text-dup.c
-  torture/unit/base/text/pdf-text-new-destroy
+  torture/unit/base/text/pdf-text-new-destroy.c
   torture/unit/base/text/pdf-text-new-from-host.c
+  torture/unit/base/text/tsuite-text.c
   torture/unit/base/types/pdf-i64-abs.c
   torture/unit/base/types/pdf-i64-mod.c
   torture/unit/base/types/pdf-i64-neg.c

=== modified file 'ChangeLog'
--- ChangeLog	2009-06-18 12:06:04 +0000
+++ ChangeLog	2009-06-22 11:20:04 +0000
@@ -1,3 +1,12 @@
+2009-06-22  Brad Hards  <[email protected]>
+
+	* src/base/pdf-text.c (pdf_text_dup): Protect against NULL arg.
+
+	* torture/unit/base/text/tsuite-text.c (tsuite_text): Reorganise
+	tests to avoid failure when running with CK_FORK="no"
+	* torture/unit/base/text/pdf-text-new-destroy.c : likewise
+
+
 2009-06-18  Brad Hards  <[email protected]>
 
 	* doc/gnupdf-arch.texi: fix typos

=== modified file 'src/base/pdf-text.c'
--- src/base/pdf-text.c	2008-11-11 21:10:14 +0000
+++ src/base/pdf-text.c	2009-06-22 11:15:11 +0000
@@ -197,6 +197,11 @@
 {
   pdf_text_t element;
 
+  if (text == NULL)
+    {
+      return NULL;
+    }
+
   /* Allocate and initialize element */
   if (pdf_text_new (&element) == PDF_OK)
     {

=== modified file 'torture/unit/base/text/pdf-text-new-destroy.c'
--- torture/unit/base/text/pdf-text-new-destroy.c	2009-06-16 18:47:36 +0000
+++ torture/unit/base/text/pdf-text-new-destroy.c	2009-06-22 11:11:04 +0000
@@ -29,9 +29,25 @@
 #include <pdf.h>
 #include <check.h>
 
+
 /*
  * Test: pdf_text_new_destroy_001
  * Description:
+ *   Create a text object without initializing the context
+ * Success conditions:
+ *   1. The call to @code{pdf_text_new} should return PDF_EBADCONTEXT
+ */
+START_TEST(pdf_text_new_destroy_001)
+{
+  pdf_text_t newtext = NULL;
+
+  fail_unless(pdf_text_new (&newtext) == PDF_EBADCONTEXT);
+}
+END_TEST
+
+/*
+ * Test: pdf_text_new_destroy_002
+ * Description:
  *   Create an empty text object and destroy it
  * Success conditions:
  *   1. The call to @code{pdf_text_new} should not return a  @code{NULL} pointer.
@@ -40,7 +56,7 @@
  *   4. The country code of the output object should be empty 
  *   5. The call to @code{pdf_text_destroy} should return PDF_OK;
  */
-START_TEST(pdf_text_new_destroy_001)
+START_TEST(pdf_text_new_destroy_002)
 {
   pdf_text_t newtext = NULL;
   
@@ -66,20 +82,6 @@
 }
 END_TEST
 
-/*
- * Test: pdf_text_new_destroy_002
- * Description:
- *   Create an text object without initializing the context
- * Success conditions:
- *   1. The call to @code{pdf_text_new} should return PDF_EBADCONTEXT
- */
-START_TEST(pdf_text_new_destroy_002)
-{
-  pdf_text_t newtext = NULL;
-
-  fail_unless(pdf_text_new (&newtext) == PDF_EBADCONTEXT);
-}
-END_TEST
 
 /*
  * Test case creation function

=== modified file 'torture/unit/base/text/tsuite-text.c'
--- torture/unit/base/text/tsuite-text.c	2008-04-13 21:56:47 +0000
+++ torture/unit/base/text/tsuite-text.c	2009-06-22 11:11:04 +0000
@@ -60,8 +60,8 @@
   
   s = suite_create("text");
 
+  suite_add_tcase (s, test_pdf_text_new_destroy());
   suite_add_tcase (s, test_pdf_text_init());
-  suite_add_tcase (s, test_pdf_text_new_destroy());
   suite_add_tcase (s, test_pdf_text_dup());
   suite_add_tcase (s, test_pdf_text_new_from_host());
   suite_add_tcase (s, test_pdf_text_new_from_pdf_string ());

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWYqAd+MABvpfgFAwWXf///9N
3kC////6YAtvneuqu72+nI6BSgGO23XOm73dUWttq9Gq0GwkkmUzUySeFNtTNE1PTT0FGm9SGnoj
EMABBKTUNTR6DKnqekxqaaADQbUGgAAAAyJo0k9U2kPRNqNAAAAAAAAARJTVPJDTSZk0mhgmTRiY
gA0B6jQACKhNJqeVPNJqeKfqj0whM1NqYj0RkaANA000EkgJpoJhNCZNTEEZoQxR+lHogHqaNpF0
QPgmReldtbfZ3vfmy8lRlx5GKtx1xXFvuVLBPtXXm+p3d+ZczN/0wjB11f/Y1dQMXz/537WbcFqg
tEMggmXDdDdwbTg/R1i4+iyqSGzcgLB1GcXxfnc9wycTT0jWzioSYXcGaQHNgW24rE4GNt7Mxdyu
DnAhQbQSEZJJBJCSSQ+2gA2trOZMHG69qwqxVwov4qsMLJyDoklgEDJODzeLIzoVAdldGQMgojMS
XJ6DDmk6xqf8Fp/0MA2ctGXFLtJ5MkUzqKHJeru6o/pk1GNaARKGAq+4Gkp6FLtVJkxQIgCT1Z5C
b/o4S77rheN4lmZsEr/L4Xc+TX8uF9fpbr2Ktaga3p0p/dfdNJJ5TdL6U3JqVrDC496TvjxjZsEA
vJ5HWMSCRlywlTzNlYfYOWLXvXox9HcUbLaOVNRTixszDHzCwhhHg4OnUwGDw3SgMmEB4XBU2qLV
A5c09B1n7vFUNR6nBA4U0g2JJMl54r8nDRVt+MhIQhyqg9iIgfgOdVvcduMQsvWEwZqHAqqqqNbV
H1CXBpnOCB4QHuDv23zvSA9jChv2dJQk5c1+y6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