free the allocated memory
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4350 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f555ea4420
commit
b33ce7e1df
1 changed files with 11 additions and 0 deletions
|
@ -143,15 +143,18 @@ void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
|
||||||
|
|
||||||
// allocate language struct
|
// allocate language struct
|
||||||
langs = (struct lang *)GlobalAlloc(GPTR, langs_num*sizeof(struct lang));
|
langs = (struct lang *)GlobalAlloc(GPTR, langs_num*sizeof(struct lang));
|
||||||
|
if (!langs) return;
|
||||||
|
|
||||||
// fill language struct
|
// fill language struct
|
||||||
for (i = 0; i < langs_num; i++) {
|
for (i = 0; i < langs_num; i++) {
|
||||||
if (popstring(temp)) return;
|
if (popstring(temp)) return;
|
||||||
langs[i].name = GlobalAlloc(GPTR, lstrlen(temp)+1);
|
langs[i].name = GlobalAlloc(GPTR, lstrlen(temp)+1);
|
||||||
|
if (!langs[i].name) return;
|
||||||
lstrcpy(langs[i].name, temp);
|
lstrcpy(langs[i].name, temp);
|
||||||
|
|
||||||
if (popstring(temp)) return;
|
if (popstring(temp)) return;
|
||||||
langs[i].id = GlobalAlloc(GPTR, lstrlen(temp)+1);
|
langs[i].id = GlobalAlloc(GPTR, lstrlen(temp)+1);
|
||||||
|
if (!langs[i].id) return;
|
||||||
lstrcpy(langs[i].id, temp);
|
lstrcpy(langs[i].id, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +163,15 @@ void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
|
||||||
if (popstring(temp)) return;
|
if (popstring(temp)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start dialog
|
||||||
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG), 0, DialogProc);
|
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG), 0, DialogProc);
|
||||||
|
|
||||||
|
// free structs
|
||||||
|
for (i = 0; i < langs_num; i++) {
|
||||||
|
GlobalFree(langs[i].name);
|
||||||
|
GlobalFree(langs[i].id);
|
||||||
|
}
|
||||||
|
GlobalFree(langs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue