Skip to content
Snippets Groups Projects
Commit 26985cf3 authored by Nguyen Anh Quynh's avatar Nguyen Anh Quynh
Browse files

Merge branch 'memleak2' of https://github.com/mrexodia/beta into mrexodia-memleak2

parents 2a5df023 19864990
No related branches found
No related tags found
No related merge requests found
......@@ -223,6 +223,7 @@ ks_err ks_open(ks_arch arch, int mode, ks_engine **result)
if (arch < KS_ARCH_MAX) {
ks = new (std::nothrow) ks_struct();
memset(ks, 0, sizeof(*ks));
if (!ks) {
// memory insufficient
return KS_ERR_NOMEM;
......@@ -446,6 +447,7 @@ ks_err ks_close(ks_engine *ks)
#endif
// finally, free ks itself.
memset(ks, 0, sizeof(*ks));
delete ks;
return KS_ERR_OK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment