* ext/openssl/ossl_config.c (Init_ossl_config): memory leak fixed.
a patch <shinichiro.hamaji at gmail.com> 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
This commit is contained in:
parent
34e157478b
commit
6ada14922f
@ -1,3 +1,12 @@
|
|||||||
|
Sat Aug 30 15:43:03 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/openssl/ossl_config.c (Init_ossl_config): memory leak fixed.
|
||||||
|
a patch <shinichiro.hamaji at gmail.com> in [ruby-dev:35880].
|
||||||
|
|
||||||
|
* ext/openssl/ossl_x509ext.c (ossl_x509ext_set_value): ditto.
|
||||||
|
|
||||||
|
* ext/strscan/strscan.c (strscan_do_scan): ditto.
|
||||||
|
|
||||||
Sat Aug 30 14:58:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Aug 30 14:58:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/openssl/ossl_x509ext.c (ossl_x509ext_initialize): fix for
|
* ext/openssl/ossl_x509ext.c (ossl_x509ext_initialize): fix for
|
||||||
|
@ -443,8 +443,10 @@ Init_ossl_config()
|
|||||||
eConfigError = rb_define_class_under(mOSSL, "ConfigError", eOSSLError);
|
eConfigError = rb_define_class_under(mOSSL, "ConfigError", eOSSLError);
|
||||||
cConfig = rb_define_class_under(mOSSL, "Config", rb_cObject);
|
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_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_include_module(cConfig, rb_mEnumerable);
|
||||||
rb_define_singleton_method(cConfig, "parse", ossl_config_s_parse, 1);
|
rb_define_singleton_method(cConfig, "parse", ossl_config_s_parse, 1);
|
||||||
rb_define_alias(CLASS_OF(cConfig), "load", "new");
|
rb_define_alias(CLASS_OF(cConfig), "load", "new");
|
||||||
|
@ -333,6 +333,7 @@ ossl_x509ext_set_value(VALUE self, VALUE data)
|
|||||||
ASN1_OCTET_STRING_free(asn1s);
|
ASN1_OCTET_STRING_free(asn1s);
|
||||||
ossl_raise(eX509ExtError, NULL);
|
ossl_raise(eX509ExtError, NULL);
|
||||||
}
|
}
|
||||||
|
free(s);
|
||||||
GetX509Ext(self, ext);
|
GetX509Ext(self, ext);
|
||||||
X509_EXTENSION_set_data(ext, asn1s);
|
X509_EXTENSION_set_data(ext, asn1s);
|
||||||
|
|
||||||
|
@ -407,6 +407,7 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
|||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
regex_t *re;
|
regex_t *re;
|
||||||
int ret;
|
int ret;
|
||||||
|
int tmpreg;
|
||||||
|
|
||||||
Check_Type(regex, T_REGEXP);
|
Check_Type(regex, T_REGEXP);
|
||||||
GET_SCANNER(self, p);
|
GET_SCANNER(self, p);
|
||||||
@ -416,6 +417,9 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
re = rb_reg_prepare_re(regex, p->str);
|
re = rb_reg_prepare_re(regex, p->str);
|
||||||
|
tmpreg = re != RREGEXP(regex)->ptr;
|
||||||
|
if (!tmpreg) RREGEXP(regex)->usecnt++;
|
||||||
|
|
||||||
if (headonly) {
|
if (headonly) {
|
||||||
ret = onig_match(re, (UChar* )CURPTR(p),
|
ret = onig_match(re, (UChar* )CURPTR(p),
|
||||||
(UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
(UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
||||||
@ -427,6 +431,16 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
|||||||
(UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
(UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
||||||
&(p->regs), ONIG_OPTION_NONE);
|
&(p->regs), ONIG_OPTION_NONE);
|
||||||
}
|
}
|
||||||
|
if (!tmpreg) RREGEXP(re)->usecnt--;
|
||||||
|
if (tmpreg) {
|
||||||
|
if (RREGEXP(regex)->usecnt) {
|
||||||
|
onig_free(re);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onig_free(RREGEXP(regex)->ptr);
|
||||||
|
RREGEXP(regex)->ptr = re;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == -2) rb_raise(ScanError, "regexp buffer overflow");
|
if (ret == -2) rb_raise(ScanError, "regexp buffer overflow");
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user