#include <math.h>\r
\r
#include "openjpeg.h"\r
+#include "opj_includes.h"\r
#include "opj_getopt.h"\r
#include "convert.h"\r
#include "dirent.h"\r
\r
case 'y': /* Image Directory path */\r
{\r
- img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);\r
+ img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);\r
strcpy(img_fol->imgdirpath,opj_optarg);\r
img_fol->set_imgdir=1;\r
}\r
/* Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.*/\r
arraySize = (*env)->GetArrayLength(env, javaParameters);\r
argc = (int) arraySize +1;\r
- argv = malloc(argc*sizeof(char*));\r
+ argv = opj_malloc(argc*sizeof(char*));\r
argv[0] = "ProgramName.exe"; /* The program name: useless*/\r
j=0;\r
for (i=1; i<argc; i++) {\r
fseek(fsrc, 0, SEEK_END);\r
file_length = ftell(fsrc);\r
fseek(fsrc, 0, SEEK_SET);\r
- src = (unsigned char *) malloc(file_length);\r
+ src = (unsigned char *) opj_malloc(file_length);\r
fread(src, 1, file_length, fsrc);\r
fclose(fsrc);\r
/*printf("C: %d bytes read from file\n",file_length);*/\r
\r
/* free the memory containing the code-stream */\r
if (parameters.infile && parameters.infile[0]!='\0') {\r
- free(src);\r
+ opj_free(src);\r
} else {\r
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);\r
}\r