mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] fix a potential resource leak
* IsFontAvailable() could exit without releasing its 'hDC' handle resulting in a resource leak * Fix V773 from PSV-Studio * Closes #1050
This commit is contained in:
parent
6a45a678b3
commit
fa94abcc8e
2 changed files with 8 additions and 6 deletions
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 2.18.1207"
|
||||
CAPTION "Rufus 2.18.1208"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||
|
@ -366,8 +366,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,18,1207,0
|
||||
PRODUCTVERSION 2,18,1207,0
|
||||
FILEVERSION 2,18,1208,0
|
||||
PRODUCTVERSION 2,18,1208,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -384,13 +384,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.18.1207"
|
||||
VALUE "FileVersion", "2.18.1208"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "2.18.1207"
|
||||
VALUE "ProductVersion", "2.18.1208"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -634,8 +634,10 @@ BOOL IsFontAvailable(const char* font_name) {
|
|||
LOGFONTA lf = { 0 };
|
||||
HDC hDC = GetDC(hMainDialog);
|
||||
|
||||
if (font_name == NULL)
|
||||
if (font_name == NULL) {
|
||||
ReleaseDC(hMainDialog, hDC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
safe_strcpy(lf.lfFaceName, LF_FACESIZE, font_name);
|
||||
|
|
Loading…
Reference in a new issue