case 'b': { /* code-block dimension */
int cblockw_init = 0, cblockh_init = 0;
sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init);
- if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
- || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
+ if (cblockw_init > 1024 || cblockw_init < 4 ||
+ cblockh_init > 1024 || cblockh_init < 4 ||
+ cblockw_init * cblockh_init > 4096) {
fprintf(stderr,
"!! Size of code_block error (option -b) !!\n\nRestriction :\n"
" * width*height<=4096\n * 4<=width,height<= 1024\n\n");
/*
configure the event callbacks (not required)
- setting of each callback is optionnal
+ setting of each callback is optional
*/
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
if (dirptr) {
dirptr->filename_buf = (char*)malloc(num_images * OPJ_PATH_LEN * sizeof(
char)); /* Stores at max 10 image file names*/
- dirptr->filename = (char**) malloc(num_images * sizeof(char*));
if (!dirptr->filename_buf) {
+ free(parameters.cp_comment);
+ free(dirptr);
+ return 0;
+ }
+ dirptr->filename = (char**) malloc(num_images * sizeof(char*));
+ if (!dirptr->filename) {
+ free(parameters.cp_comment);
+ free(dirptr);
return 0;
}
for (i = 0; i < num_images; i++) {
}
}
if (load_images(dirptr, img_fol.imgdirpath) == 1) {
+ free(parameters.cp_comment);
+ free(dirptr);
return 0;
}
if (num_images == 0) {
+ free(parameters.cp_comment);
+ free(dirptr);
fprintf(stdout, "Folder is empty\n");
return 0;
}
if (res < (size_t)codestream_length) { /* FIXME */
fprintf(stderr, "failed to write %d (%s)\n", codestream_length,
parameters.outfile);
+ fclose(f);
return 1;
}
fclose(f);
if (res < (size_t)codestream_length) { /* FIXME */
fprintf(stderr, "failed to write %d (%s)\n", codestream_length,
parameters.outfile);
+ fclose(f);
return 1;
}
fclose(f);