summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-26 09:28:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-26 09:28:46 +0000
commit79c50a77ff210baa369e5c0babc44b1a0da23fbe (patch)
treebaa3d83c344c53ef9a3b5913a44268426c248921 /gc.c
parentd0035dbdf83a48bd96fc1e0646b4ae01d3a2f135 (diff)
get rid of strcpy
* addr2line.c (follow_debuglink): insert global_debug_dir by using memmove instead of copying to temporary buffer. * dln.c (dln_load): use memcpy with the known length instead of strcpy. * gc.c (rb_gc_unprotect_logging): use strdup instead of malloc and strcpy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 847062557f..d39d14d709 100644
--- a/gc.c
+++ b/gc.c
@@ -6003,9 +6003,8 @@ rb_gc_unprotect_logging(void *objptr, const char *filename, int line)
cnt++;
}
else {
- ptr = (char *)malloc(strlen(buff) + 1);
+ ptr = (strdup)(buff);
if (!ptr) rb_memerror();
- strcpy(ptr, buff);
}
st_insert(rgengc_unprotect_logging_table, (st_data_t)ptr, cnt);
}