fp = fopen(playlist_path, "rb");
media_content_retvm_if(fp == NULL, MEDIA_CONTENT_ERROR_INVALID_OPERATION, "fopen fail");
- fseek(fp, 0, SEEK_END);
+ if (fseek(fp, 0, SEEK_END) < 0) {
+ media_content_stderror("fseek failed");
+ fclose(fp);
+ return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+ }
file_size = ftell(fp);
- fseek(fp, 0 , SEEK_SET);
-
if (file_size == 0) {
media_content_debug("file is empty.");
fclose(fp);
return MEDIA_CONTENT_ERROR_NONE;
}
+ if (fseek(fp, 0, SEEK_SET) < 0) {
+ media_content_stderror("fseek failed");
+ fclose(fp);
+ return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+ }
+
*item_list = calloc(current_max_size, sizeof(char*));
if (*item_list == NULL) {
fclose(fp);