diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-29 05:55:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-29 05:55:02 +0000 |
commit | 451fe269e5ab1270a53ac7bdeceabe47fd431f95 (patch) | |
tree | ed014c958a0f622db02af64186def2c70e4c00ba /ext/openssl/ossl_cipher.c | |
parent | 5924f9a684ace630d3658a0d6e52270e3686ca9f (diff) | |
download | ruby-451fe269e5ab1270a53ac7bdeceabe47fd431f95.tar.gz |
openssl: wrapper object before alloc
* ext/openssl: make wrapper objects before allocating structs to
get rid of potential memory leaks.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_cipher.c')
-rw-r--r-- | ext/openssl/ossl_cipher.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c index 72eaa3f31d..3e92d65668 100644 --- a/ext/openssl/ossl_cipher.c +++ b/ext/openssl/ossl_cipher.c @@ -10,8 +10,8 @@ */ #include "ossl.h" -#define WrapCipher(obj, klass, ctx) \ - (obj) = TypedData_Wrap_Struct((klass), &ossl_cipher_type, (ctx)) +#define NewCipher(klass) \ + TypedData_Wrap_Struct((klass), &ossl_cipher_type, 0) #define MakeCipher(obj, klass, ctx) \ (obj) = TypedData_Make_Struct((klass), EVP_CIPHER_CTX, &ossl_cipher_type, (ctx)) #define AllocCipher(obj, ctx) \ @@ -98,11 +98,7 @@ ossl_cipher_memsize(const void *ptr) static VALUE ossl_cipher_alloc(VALUE klass) { - VALUE obj; - - WrapCipher(obj, klass, 0); - - return obj; + return NewCipher(klass); } /* |