tests/test-strstr.c: Rewrite to use malloc/strcpy instead of strdup.
authorSimon Josefsson <simon@josefsson.org>
Tue, 26 May 2009 13:31:53 +0000 (15:31 +0200)
committerSimon Josefsson <simon@josefsson.org>
Tue, 26 May 2009 13:31:53 +0000 (15:31 +0200)
Suggested by Eric Blake  <ebb9@byu.net>.

ChangeLog
tests/test-strstr.c

index 96d5f10..5b5348c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2009-05-26  Simon Josefsson  <simon@josefsson.org>
 
        * tests/test-strstr.c: Add another self-test.
+       * tests/test-strstr.c: Rewrite to use malloc/strcpy instead of
+       strdup.  Suggested by Eric Blake  <ebb9@byu.net>.
 
 2009-05-23  Bruno Haible  <bruno@clisp.org>
 
index d8bec15..600f7c7 100644 (file)
@@ -62,8 +62,12 @@ main (int argc, char *argv[])
 
   {
     /* See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 */
-    char *input = strdup ("aBaaaaaaaaaaax");
-    const char *result = strstr (input, "B1x");
+    const char *fix = "aBaaaaaaaaaaax";
+    char *input = malloc (strlen (fix) + 1);
+    const char *result;
+
+    strcpy (input, fix);
+    result = strstr (input, "B1x");
     ASSERT (result == NULL);
     free (input);
   }