1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 19:38:26 -06:00

Windows:Fix various issues and warnings reported by static code analysis tool Coverity.

This commit is contained in:
Mounir IDRASSI
2016-02-07 02:07:38 +01:00
parent 229bd668f4
commit ae7ec4802a
22 changed files with 175 additions and 115 deletions

View File

@@ -119,20 +119,26 @@ KeyFile *KeyFileClone (KeyFile *keyFile)
}
KeyFile *KeyFileCloneAll (KeyFile *firstKeyFile)
void KeyFileCloneAll (KeyFile *firstKeyFile, KeyFile **outputKeyFile)
{
KeyFile *cloneFirstKeyFile = KeyFileClone (firstKeyFile);
KeyFile *kf;
if (firstKeyFile == NULL) return NULL;
kf = firstKeyFile->Next;
while (kf != NULL)
if (outputKeyFile)
{
KeyFileAdd (cloneFirstKeyFile, KeyFileClone (kf));
kf = kf->Next;
}
KeyFile *cloneFirstKeyFile = KeyFileClone (firstKeyFile);
KeyFile *kf;
return cloneFirstKeyFile;
KeyFileRemoveAll (outputKeyFile);
if (firstKeyFile)
{
kf = firstKeyFile->Next;
while (kf != NULL)
{
KeyFileAdd (cloneFirstKeyFile, KeyFileClone (kf));
kf = kf->Next;
}
*outputKeyFile = cloneFirstKeyFile;
}
}
}
@@ -451,7 +457,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
param = (KeyFilesDlgParam *) lParam;
origParam = *(KeyFilesDlgParam *) lParam;
param->FirstKeyFile = KeyFileCloneAll (param->FirstKeyFile);
KeyFileCloneAll (param->FirstKeyFile, &param->FirstKeyFile);
LocalizeDialog (hwndDlg, "IDD_KEYFILES");
DragAcceptFiles (hwndDlg, TRUE);
@@ -637,7 +643,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
if (kf)
{
DragQueryFile (hdrop, i++, kf->FileName, sizeof (kf->FileName));
DragQueryFile (hdrop, i++, kf->FileName, ARRAYSIZE (kf->FileName));
param->FirstKeyFile = KeyFileAdd (param->FirstKeyFile, kf);
LoadKeyList (hwndDlg, param->FirstKeyFile);
}