From: Simon Josefsson Date: Tue, 26 May 2009 13:31:53 +0000 (+0200) Subject: tests/test-strstr.c: Rewrite to use malloc/strcpy instead of strdup. X-Git-Tag: v0.1~5896 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=5b63b76064a130bdaadb1fda7ab50e82896446e1;p=gnulib.git tests/test-strstr.c: Rewrite to use malloc/strcpy instead of strdup. Suggested by Eric Blake . --- diff --git a/ChangeLog b/ChangeLog index 96d5f10ec..5b5348c59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2009-05-26 Simon Josefsson * tests/test-strstr.c: Add another self-test. + * tests/test-strstr.c: Rewrite to use malloc/strcpy instead of + strdup. Suggested by Eric Blake . 2009-05-23 Bruno Haible diff --git a/tests/test-strstr.c b/tests/test-strstr.c index d8bec1504..600f7c786 100644 --- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -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); }