VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-06-03 09:08:15 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-08 23:19:10 +0100
commit5ebd79745d84faa9fb352ed2bc58931f37975d85 (patch)
treeca17e958cf9297bc800becf25d5f7d88cf99fb10
parent1763e8a2ba64517fece9f10f1a0011f31975318f (diff)
downloadVeraCrypt-5ebd79745d84faa9fb352ed2bc58931f37975d85.tar.gz
VeraCrypt-5ebd79745d84faa9fb352ed2bc58931f37975d85.zip
Use calloc directly instead of combining malloc and ZeroMemory
-rw-r--r--src/Common/Dlgcode.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index ed8d608a..71293bcd 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -7404,7 +7404,7 @@ char *LoadFile (const char *fileName, DWORD *size)
return NULL;
*size = GetFileSize (h, NULL);
- buf = (char *) malloc (*size + 1);
+ buf = (char *) calloc (*size + 1, 1);
if (buf == NULL)
{
@@ -7412,8 +7412,6 @@ char *LoadFile (const char *fileName, DWORD *size)
return NULL;
}
- ZeroMemory (buf, *size + 1);
-
if (!ReadFile (h, buf, *size, size, NULL))
{
free (buf);
@@ -7444,18 +7442,15 @@ char *LoadFileBlock (char *fileName, __int64 fileOffset, size_t count)
return NULL;
}
- buf = (char *) malloc (count);
+ buf = (char *) calloc (count, 1);
if (buf == NULL)
{
CloseHandle (h);
return NULL;
}
-
- ZeroMemory (buf, count);
- if (buf != NULL)
- ReadFile (h, buf, count, &bytesRead, NULL);
+ ReadFile (h, buf, count, &bytesRead, NULL);
CloseHandle (h);