From 6ada14922f6ff406f17a34192132ec17bce75ce6 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 30 Aug 2008 06:54:25 +0000 Subject: * ext/openssl/ossl_config.c (Init_ossl_config): memory leak fixed. a patch in [ruby-dev:35880]. * ext/openssl/ossl_x509ext.c (ossl_x509ext_set_value): ditto. * ext/strscan/strscan.c (strscan_do_scan): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl_config.c | 4 +++- ext/openssl/ossl_x509ext.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'ext/openssl') diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index baa573d4bb..f305af47b2 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -443,8 +443,10 @@ Init_ossl_config() eConfigError = rb_define_class_under(mOSSL, "ConfigError", eOSSLError); cConfig = rb_define_class_under(mOSSL, "Config", rb_cObject); + const char *default_config_file = CONF_get1_default_config_file(); rb_define_const(cConfig, "DEFAULT_CONFIG_FILE", - rb_str_new2(CONF_get1_default_config_file())); + rb_str_new2(default_config_file)); + OPENSSL_free(default_config_file); rb_include_module(cConfig, rb_mEnumerable); rb_define_singleton_method(cConfig, "parse", ossl_config_s_parse, 1); rb_define_alias(CLASS_OF(cConfig), "load", "new"); diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index f08006f34b..64867039f2 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -333,6 +333,7 @@ ossl_x509ext_set_value(VALUE self, VALUE data) ASN1_OCTET_STRING_free(asn1s); ossl_raise(eX509ExtError, NULL); } + free(s); GetX509Ext(self, ext); X509_EXTENSION_set_data(ext, asn1s); -- cgit v1.2.3