diff options
author | gocha <gochaism@gmail.com> | 2017-03-31 14:34:54 +0900 |
---|---|---|
committer | gocha <gochaism@gmail.com> | 2017-03-31 14:34:54 +0900 |
commit | 1edbc7246cd65a9a0f4c7ecd9e7e306952fe67b2 (patch) | |
tree | ad45067e9018f256d5479dde32e1b6a75ad51f34 /subhook.h | |
parent | 50a8d0ca24c514fb0b6946626e7856d85988f5a8 (diff) | |
download | subhook-1edbc7246cd65a9a0f4c7ecd9e7e306952fe67b2.zip subhook-1edbc7246cd65a9a0f4c7ecd9e7e306952fe67b2.tar.gz subhook-1edbc7246cd65a9a0f4c7ecd9e7e306952fe67b2.tar.bz2 |
Fix null reference on the destruction of empty Hook
Diffstat (limited to 'subhook.h')
-rw-r--r-- | subhook.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -145,8 +145,10 @@ class Hook { : hook_(subhook_new(src, dst, (subhook_options_t)options)) {} ~Hook() { - subhook_remove(hook_); - subhook_free(hook_); + if (hook_ != 0) { + subhook_remove(hook_); + subhook_free(hook_); + } } void *GetSrc() { return subhook_get_src(hook_); } |