diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-24 15:40:05 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-24 15:40:05 +0000 |
commit | cd2eaf2a33e42d9842ac6e6bdb50a14c8d0553ad (patch) | |
tree | 21fa75252d6d2905dc4e47159de23802d5b4e009 /mjit.c | |
parent | 461c79f17c4b01d8802bd57d893e0df75ec35d7a (diff) | |
download | ruby-cd2eaf2a33e42d9842ac6e6bdb50a14c8d0553ad.tar.gz |
mjit.c: handle memory allocation failure
which was missing in r64033.
Prior to r64033, memory allocation failure had been checked by
TRY_WITH_GC and handled by rb_memerror. But calling rb_memerror on MJIT
worker is problematic since it does EC_JUMP_TAG in the end. Threads
except Ruby's main thread must not use it.
mjit_compile.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -334,7 +334,8 @@ form_args(int num, ...) for (i = len = 0; i < num; i++) { args = va_arg(argp, char **); n = args_len(args); - res = (char **)realloc(res, sizeof(char *) * (len + n + 1)); + if ((res = (char **)realloc(res, sizeof(char *) * (len + n + 1))) == NULL) + return NULL; MEMCPY(res + len, args, char *, n + 1); len += n; } @@ -767,6 +768,8 @@ compile_c_to_so(const char *c_file, const char *so_file) #ifdef _MSC_VER solen = strlen(so_file); files[0] = p = (char *)malloc(sizeof(char) * (rb_strlen_lit("-Fe") + solen + 1)); + if (p == NULL) + return FALSE; p = append_lit(p, "-Fe"); p = append_str2(p, so_file, solen); *p = '\0'; |