Browse Source

direct3d9: fix filepath leak

In case the string is non-NULL but empty, var_InheritString returns NULL
so we can treat that case the same.

(cherry picked from commit 9d2d8f0136)
edited:
- the direct3d9 code is reordered on master
cherry-pick-c5513cf9
Johannes Kauffmann 10 months ago
parent
commit
b69ca0fa1a
  1. 6
      modules/video_output/win32/direct3d9.c

6
modules/video_output/win32/direct3d9.c

@ -1355,13 +1355,11 @@ static int Direct3D9CreateShaders(vout_display_t *vd)
goto error; /* Unrecognized entry in the list. */
/* The source code of the shader needs to be read from a file. */
char *filepath = var_InheritString(vd, "direct3d9-shader-file");
if (!filepath || !*filepath)
{
free(filepath);
if (!filepath)
goto error;
}
/* Open file, find its size with fseek/ftell and read its content in a buffer. */
fs = fopen(filepath, "rb");
free(filepath);
if (!fs)
goto error;
int ret = fseek(fs, 0, SEEK_END);

Loading…
Cancel
Save