1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/digest/digest.c (rb_digest_base_s_digest): Fix a double

free() bug mingled with allocation framework deployment.

* ext/digest/digest.c (rb_digest_base_s_hexdigest): Get rid of
  redundant struct allocation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2002-09-26 13:49:40 +00:00
parent 7c4d1fe5e0
commit b00af5f83a
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,11 @@
Thu Sep 26 22:44:21 2002 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_base_s_digest): Fix a double
free() bug mingled with allocation framework deployment.
* ext/digest/digest.c (rb_digest_base_s_hexdigest): Get rid of
redundant struct allocation.
Wed Sep 25 23:51:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* dir.c (glob_helper): must not closedir() when exception raised

View file

@ -105,7 +105,6 @@ rb_digest_base_s_digest(klass, str)
obj = rb_str_new(digest, len);
free(digest);
free(pctx);
return obj;
}
@ -121,11 +120,10 @@ rb_digest_base_s_hexdigest(klass, str)
unsigned char *hexdigest;
VALUE obj = rb_digest_base_alloc(klass);
StringValue(str);
algo = get_digest_base_metadata(klass);
Data_Get_Struct(obj, void, pctx);
pctx = xmalloc(algo->ctx_size);
algo->init_func(pctx);
StringValue(str);
algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
len = algo->digest_len * 2;
@ -136,7 +134,6 @@ rb_digest_base_s_hexdigest(klass, str)
obj = rb_str_new(hexdigest, len);
free(hexdigest);
free(pctx);
return obj;
}