Commit Diff
Diff:
f523773656c7fb53c7ec2f373fb48da5c2f1d788
a130f0271c0a856e6104a3eec0a4101b4c75f5df
Commit:
a130f0271c0a856e6104a3eec0a4101b4c75f5df
Tree:
0828480093911678f79c1811c6c80b354a4e5724
Author:
Omar Polo <op@omarpolo.com>
Date:
Fri Jun 10 08:03:22 2022 UTC
Message:
free the FILE on op_open_callbacks failure

the API is a bit of a shitshow. op_fdopen is just a wrapper around
FILE*, but returns void* for don't know what Windows limitation.

if op_open_callbacks fails we have to free the stream by ourselves.
the documentation implies that this void* pointer is, in fact, a
FILE*.
commit - f523773656c7fb53c7ec2f373fb48da5c2f1d788
commit + a130f0271c0a856e6104a3eec0a4101b4c75f5df
blob - 460b3e8d540c8ddc712a60631881dbbef4cb3212
blob + c2968bdfac8d03a696715e8b7ea56d60cb74fb17
--- player_opus.c
+++ player_opus.c
@@ -54,7 +54,7 @@ play_opus(int fd)
of = op_open_callbacks(f, &cb, NULL, 0, &r);
if (of == NULL) {
- close(fd);
+ fclose(f);
return -1;
}
Omar Polo