fseek(fp, 0, SEEK_END); \
size = ftell(fp); \
fseek(fp, 0, SEEK_SET); \
- data = malloc(size); \
- fread(data, size, sizeof(char), fp); \
+ if (size > 0) data = malloc(size); \
+ if (data != NULL) { if (fread(data, size, sizeof(char), fp) != size) { printf("fread error\n"); } } \
fclose(fp); \
printf("file size = %d\n", size); \
} \
printf("Fail metadata_extractor_set_path [%d]\n", ret);
goto exception;
}
- }
-#if 0 /* Comment out because of prevent defect */
- else {
+ } else {
printf("Extract meta from memory-----------------------\n");
- int file_size = 0;
+ unsigned int file_size = 0;
unsigned char *buffer = NULL;
/* Read file */
READ_FROM_FILE(argv[idx + 1], buffer, file_size);
goto exception;
}
}
-#endif
__capi_metadata_extractor(metadata);
printf("--------------------------------------------\n");