plugins: vbrfix: Fix fd leak & error handling

- mp3info returns true for error
- fd wasn't closed for non-vbr files

Change-Id: I5432025d3384ddf92ed0a478587dcc1715fcf524
This commit is contained in:
Christian Soffke 2023-03-26 19:08:08 +02:00
parent 2456d28e21
commit 287747591e

View file

@ -150,7 +150,7 @@ static bool vbr_fix(const char *selected_file)
xingupdate(0); xingupdate(0);
rc = rb->mp3info(&entry, selected_file); rc = rb->mp3info(&entry, selected_file);
if(rc < 0) { if(rc) {
fileerror(rc); fileerror(rc);
return true; return true;
} }
@ -258,6 +258,8 @@ static bool vbr_fix(const char *selected_file)
} }
else else
{ {
rb->close(fd);
/* Not a VBR file */ /* Not a VBR file */
DEBUGF("Not a VBR file\n"); DEBUGF("Not a VBR file\n");
rb->splash(HZ*2, ID2P(LANG_NOT_A_VBR_FILE)); rb->splash(HZ*2, ID2P(LANG_NOT_A_VBR_FILE));