diff options
author | Thomas Gaugler <thomas@dadie.net> | 2018-12-27 22:11:49 +0100 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2019-01-02 18:38:32 +0100 |
commit | 235584d09197c6174e06f03ccb150e570e1ebc1c (patch) | |
tree | cb5239515534f5f855721d3ef2114c79ac742efc | |
parent | 7a379f1f2325a57856f8ee4b42c891356c6b0117 (diff) |
Fix memory leaks in BOOTCFG_CreateGUID
-rw-r--r-- | include/bootcfg.nsh | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/bootcfg.nsh b/include/bootcfg.nsh index 8130707..59ca3f4 100644 --- a/include/bootcfg.nsh +++ b/include/bootcfg.nsh @@ -1876,11 +1876,21 @@ FunctionEnd ${If} $2 != 0 System::Call "rpcrt4::UuidCreate(p r2) i.r1" ${If} $1 == 0 - System::Call "rpcrt4::UuidToString(p r2, *t.r3) i.r1" - ${If} $1 == 0 - StrCpy $0 "{$3}" + ; Create reference pointer + System::Call "*(&t0) p.r3" + ${If} $3 != 0 + System::Call "rpcrt4::UuidToString(p r2, pr3r3) i.r1" + ${If} $1 == 0 + ; Extract string from reference pointer + System::Call "*$3(p .r0)" + System::Call "*$0(&t${NSIS_MAX_STRLEN} .r0)" + StrCpy $0 "{$0}" + System::Call "rpcrt4::RpcStringFree(pr3)" + ${EndIf} + System::Free $3 ${EndIf} ${EndIf} + System::Free $2 ${EndIf} Pop $3 |