[ruby-cvs:67929] rhe:r60748 (trunk): string.c: fix memory leak in String#crypt

rhe at ruby-lang.org rhe at ruby-lang.org
Mon Nov 13 00:55:04 JST 2017


rhe	2017-11-13 00:55:04 +0900 (Mon, 13 Nov 2017)

  New Revision: 60748

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60748

  Log:
    string.c: fix memory leak in String#crypt
    
    Use ALLOCV to allocate struct crypt_data for slightly cleaner and less
    error-prone code. It is currently possible it leaks when an invalid
    argument is passed to String#crypt or rb_str_new_cstr() fails to
    allocate memory.
    
    SIZEOF_CRYPT_DATA macro in missing/crypt.h is removed since it is not
    used any longer.

  Modified files:
    trunk/missing/crypt.h
    trunk/string.c


More information about the ruby-cvs mailing list