if (!bSuccess) {
fprintf(stderr, "failed to encode image: opj_start_compress\n");
}
- if( bUseTiles ) {
+ if( bSuccess && bUseTiles ) {
OPJ_BYTE *l_data;
OPJ_UINT32 l_data_size = 512*512*3;
l_data = (OPJ_BYTE*) malloc( l_data_size * sizeof(OPJ_BYTE));
opj_destroy_codec(l_codec);
opj_image_destroy(image);
fprintf(stderr, "failed to encode image\n");
+ remove(parameters.outfile);
return 1;
}
/* destroy the codestream index */
opj_destroy_cstr_index(&cstr_index);
+ if(failed) remove(parameters.outfile);
}
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}