Skip to content

Commit 94dc3a4

Browse files
committed
cleanup GetTempDirectoryPath
1 parent 7563a13 commit 94dc3a4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/system_utils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,18 +409,18 @@ char *GetImagePath(void)
409409
// Retrieves the path to the temporary directory for the current user.
410410
char *GetTempDirectoryPath(void)
411411
{
412-
char *temp_dir = calloc(1, MAX_PATH);
412+
char *temp_dir = calloc(MAX_PATH, sizeof(*temp_dir));
413413
if (!temp_dir) {
414-
APP_ERROR("Failed to memory allocate for get temp directory");
414+
APP_ERROR("Memory allocation failed for temp directory");
415415
return NULL;
416416
}
417417

418418
if (!GetTempPath(MAX_PATH, temp_dir)) {
419-
APP_ERROR("Failed to get temp path (%lu)", GetLastError());
419+
DWORD err = GetLastError();
420+
APP_ERROR("Failed to get temp path, Error=%lu", err);
420421
free(temp_dir);
421422
return NULL;
422423
}
423-
424424
return temp_dir;
425425
}
426426

0 commit comments

Comments
 (0)