test/testiconv.c
branchSDL-1.2
changeset 3997 6a4f3a32c2e6
parent 1528 ff3322d66771
     1.1 --- a/test/testiconv.c	Tue Jul 03 09:53:26 2007 +0000
     1.2 +++ b/test/testiconv.c	Wed Jul 04 04:27:47 2007 +0000
     1.3 @@ -53,12 +53,16 @@
     1.4  		for ( i = 0; i < SDL_arraysize(formats); ++i ) {
     1.5  			test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len);
     1.6  			test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len);
     1.7 -			if ( SDL_memcmp(test[1], ucs4, len) != 0 ) {
     1.8 +			if ( !test[1] || SDL_memcmp(test[1], ucs4, len) != 0 ) {
     1.9  				fprintf(stderr, "FAIL: %s\n", formats[i]);
    1.10  				++errors;
    1.11  			}
    1.12 -			SDL_free(test[0]);
    1.13 -			SDL_free(test[1]);
    1.14 +			if ( test[0] ) {
    1.15 +				SDL_free(test[0]);
    1.16 +			}
    1.17 +			if ( test[1] ) {
    1.18 +				SDL_free(test[1]);
    1.19 +			}
    1.20  		}
    1.21  		test[0] = SDL_iconv_string("UTF-8", "UCS-4", ucs4, len);
    1.22  		SDL_free(ucs4);