From 0b845a845811f4b48e5bfdaa1ba1e2fc5f50dccc Mon Sep 17 00:00:00 2001 From: rhe Date: Sun, 12 Nov 2017 15:55:04 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- missing/crypt.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'missing') diff --git a/missing/crypt.h b/missing/crypt.h index 7a78767931..7c2642f593 100644 --- a/missing/crypt.h +++ b/missing/crypt.h @@ -237,8 +237,6 @@ struct crypt_data { char cryptresult[1+4+4+11+1]; /* encrypted result */ }; -#define SIZEOF_CRYPT_DATA (KS_SIZE*8+(1+4+4+11+1)) - char *crypt(const char *key, const char *setting); void setkey(const char *key); void encrypt(char *block, int flag); -- cgit v1.2.1