properly initialize script_cmd_args for each SetScript
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5046 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
fb3bcd24be
commit
3a657559b0
1 changed files with 12 additions and 3 deletions
|
@ -76,13 +76,23 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
return msg.wParam;
|
||||
}
|
||||
|
||||
void SetScript(const char *script)
|
||||
void SetScript(const char *script, bool clearArgs = true)
|
||||
{
|
||||
if (g_sdata.script)
|
||||
{
|
||||
GlobalFree(g_sdata.script);
|
||||
}
|
||||
|
||||
if (clearArgs)
|
||||
{
|
||||
if (g_sdata.script_cmd_args);
|
||||
{
|
||||
GlobalFree(g_sdata.script_cmd_args);
|
||||
}
|
||||
|
||||
g_sdata.script_cmd_args = (char *) GlobalAlloc(GPTR, 1)
|
||||
}
|
||||
|
||||
g_sdata.script = (char *) GlobalAlloc(GPTR, lstrlen(script) + 1);
|
||||
lstrcpy(g_sdata.script, script);
|
||||
}
|
||||
|
@ -144,7 +154,7 @@ void ProcessCommandLine()
|
|||
}
|
||||
else
|
||||
{
|
||||
SetScript(argv[i]);
|
||||
SetScript(argv[i], false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +192,6 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
RestoreCompressor();
|
||||
SetScript("");
|
||||
g_sdata.compressor = COMPRESSOR_NONE_SELECTED;
|
||||
g_sdata.script_cmd_args = (char *) GlobalAlloc(GPTR, 1);
|
||||
g_sdata.userSelectCompressor = FALSE;
|
||||
|
||||
ProcessCommandLine();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue