diff --git a/api/libsphinxclient/test.c b/api/libsphinxclient/test.c index 495715f1c..237928ac4 100644 --- a/api/libsphinxclient/test.c +++ b/api/libsphinxclient/test.c @@ -16,6 +16,7 @@ #include #include #include +#include #if _WIN32 #include @@ -218,7 +219,8 @@ void test_excerpt_spz ( sphinx_client * client ) void test_persist_work ( sphinx_client * client ) { - char * docs[] = { NULL }; + const char * docs[] = { NULL }; + char *docs0; const char words[] = "that is"; const char * index = "test1"; const char filler[] = " no need to worry about "; @@ -229,13 +231,14 @@ void test_persist_work ( sphinx_client * client ) // should be in sync with sphinxclient.c MAX_PACKET_LEN i = 8*1024*1024 + 50; - docs[0] = malloc ( i ); - if ( !docs[0] ) + docs0 = malloc ( i ); + if ( !docs0 ) die ( "malloc failed at test_persist_work" ); + docs[0] = docs0; - memcpy ( docs[0], words, sizeof(words)-1 ); - doc = docs[0] + sizeof(words)-1; - while ( ( doc + sizeof(filler) )