metadata: Fix NFO parsing

The switch to dymanic allocation was botched. Fix it.
This commit is contained in:
Justin Maggard 2017-07-28 17:28:15 -07:00
parent 4df5400cb1
commit ca08f4540f

View File

@ -174,7 +174,7 @@ parse_nfo(const char *path, metadata_t *m)
} }
DPRINTF(E_DEBUG, L_METADATA, "Parsing .nfo file: %s\n", path); DPRINTF(E_DEBUG, L_METADATA, "Parsing .nfo file: %s\n", path);
buf = calloc(1, file.st_size + 1); buf = calloc(1, file.st_size + 1);
if (buf) if (!buf)
return; return;
nfo = fopen(path, "r"); nfo = fopen(path, "r");
if (!nfo) if (!nfo)
@ -182,7 +182,7 @@ parse_nfo(const char *path, metadata_t *m)
free(buf); free(buf);
return; return;
} }
nread = fread(&buf, 1, sizeof(buf), nfo); nread = fread(buf, 1, file.st_size, nfo);
fclose(nfo); fclose(nfo);
ParseNameValue(buf, nread, &xml, 0); ParseNameValue(buf, nread, &xml, 0);