[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

@ -1428,7 +1428,6 @@ DWORD WINAPI FormatThread(void* param)
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
HANDLE hLogicalVolume = INVALID_HANDLE_VALUE;
SYSTEMTIME lt;
FILE* log_fd;
uint8_t *buffer = NULL, extra_partitions = 0;
char *bb_msg, *volume_name = NULL;
char drive_name[] = "?:\\";
@ -1561,6 +1560,7 @@ DWORD WINAPI FormatThread(void* param)
if (IsChecked(IDC_BAD_BLOCKS)) {
do {
FILE* log_fd;
int sel = ComboBox_GetCurSel(hNBPasses);
// create a log file for bad blocks report. Since %USERPROFILE% may
// 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);
log_fd = fopenU(logfile, "w+");
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 {
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);