Skip to content

Commit

Permalink
Fix memory leak in win32_fopen()
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly committed Dec 2, 2023
1 parent 7c4fd4f commit b82f2af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/win32/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ FILE* win32_fopen(const char *filename_utf8, const char *mode_utf8)
MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, filename_w, n);
MultiByteToWideChar(CP_UTF8, 0, mode_utf8, -1, mode_w, n);
FILE *fh = _wfopen(filename_w, mode_w);
free(filename_w);
free(mode_w);
if (fh)
return fh;
}
}
free(filename_w);
}
}
// Try with regular old fopen.
Expand Down

0 comments on commit b82f2af

Please sign in to comment.