1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] fix 2 Coverity warnings

* Yay, for once Coverity actually found an actual issue!
This commit is contained in:
Pete Batard 2023-03-09 09:55:17 +00:00
parent 21ac145a4b
commit 65542b9179
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 8 additions and 9 deletions

View file

@ -2607,14 +2607,12 @@ BOOL InitializeDisk(HANDLE hDrive)
(BYTE*)&CreateDisk, size, NULL, 0, &size, NULL ); (BYTE*)&CreateDisk, size, NULL, 0, &size, NULL );
if (!r) { if (!r) {
uprintf("Could not delete drive layout: %s", WindowsErrorString()); uprintf("Could not delete drive layout: %s", WindowsErrorString());
safe_closehandle(hDrive);
return FALSE; return FALSE;
} }
r = DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &size, NULL ); r = DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &size, NULL );
if (!r) { if (!r) {
uprintf("Could not refresh drive layout: %s", WindowsErrorString()); uprintf("Could not refresh drive layout: %s", WindowsErrorString());
safe_closehandle(hDrive);
return FALSE; return FALSE;
} }

View file

@ -1428,7 +1428,6 @@ DWORD WINAPI FormatThread(void* param)
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE; HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
HANDLE hLogicalVolume = INVALID_HANDLE_VALUE; HANDLE hLogicalVolume = INVALID_HANDLE_VALUE;
SYSTEMTIME lt; SYSTEMTIME lt;
FILE* log_fd;
uint8_t *buffer = NULL, extra_partitions = 0; uint8_t *buffer = NULL, extra_partitions = 0;
char *bb_msg, *volume_name = NULL; char *bb_msg, *volume_name = NULL;
char drive_name[] = "?:\\"; char drive_name[] = "?:\\";
@ -1561,6 +1560,7 @@ DWORD WINAPI FormatThread(void* param)
if (IsChecked(IDC_BAD_BLOCKS)) { if (IsChecked(IDC_BAD_BLOCKS)) {
do { do {
FILE* log_fd;
int sel = ComboBox_GetCurSel(hNBPasses); int sel = ComboBox_GetCurSel(hNBPasses);
// create a log file for bad blocks report. Since %USERPROFILE% may // create a log file for bad blocks report. Since %USERPROFILE% may
// have localized characters, we use the UTF-8 API. // have localized characters, we use the UTF-8 API.
@ -1573,7 +1573,8 @@ DWORD WINAPI FormatThread(void* param)
lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond); lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond);
log_fd = fopenU(logfile, "w+"); log_fd = fopenU(logfile, "w+");
if (log_fd == NULL) { if (log_fd == NULL) {
uprintf("Could not create log file for bad blocks check"); uprintf("Error: Could not create log file for bad blocks check");
goto out;
} else { } else {
fprintf(log_fd, APPLICATION_NAME " bad blocks check started on: %04d.%02d.%02d %02d:%02d:%02d", fprintf(log_fd, APPLICATION_NAME " bad blocks check started on: %04d.%02d.%02d %02d:%02d:%02d",
lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond); lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond);

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.22.1990" CAPTION "Rufus 3.22.1991"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -392,8 +392,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,22,1990,0 FILEVERSION 3,22,1991,0
PRODUCTVERSION 3,22,1990,0 PRODUCTVERSION 3,22,1991,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.22.1990" VALUE "FileVersion", "3.22.1991"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.22.exe" VALUE "OriginalFilename", "rufus-3.22.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.22.1990" VALUE "ProductVersion", "3.22.1991"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"