summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-08 10:01:40 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-08 10:01:40 +0000
commit72ba13aa8e86eb7f12bd17737a689ad2ec214036 (patch)
treea45e9d137742a163baea3ee66c918c18b9808b1e /file.c
parent4a7311e12977ca2cd388f609c3c705ba219bfee5 (diff)
* array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/file.c b/file.c
index 447be55e0c..1d1fab254d 100644
--- a/file.c
+++ b/file.c
@@ -184,7 +184,7 @@ stat_new_0(VALUE klass, struct stat *st)
nst = ALLOC(struct stat);
*nst = *st;
}
- return Data_Wrap_Struct(klass, NULL, free, nst);
+ return Data_Wrap_Struct(klass, NULL, -1, nst);
}
static VALUE
@@ -2276,11 +2276,11 @@ rb_file_s_readlink(VALUE klass, VALUE path)
buf = xrealloc(buf, size);
}
if (rv < 0) {
- free(buf);
+ xfree(buf);
rb_sys_fail(RSTRING_PTR(path));
}
v = rb_tainted_str_new(buf, rv);
- free(buf);
+ xfree(buf);
return v;
#else
@@ -2453,7 +2453,7 @@ getcwdofdrv(int drv)
if (chdir(drive) == 0) {
drvcwd = my_getcwd();
chdir(oldcwd);
- free(oldcwd);
+ xfree(oldcwd);
}
else {
/* perhaps the drive is not exist. we return only drive letter */
@@ -2688,7 +2688,7 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
dirlen = strlen(dir);
BUFCHECK(dirlen > buflen);
strcpy(buf, dir);
- free(dir);
+ xfree(dir);
SET_EXTERNAL_ENCODING();
}
p = chompdirsep(skiproot(buf));
@@ -2708,7 +2708,7 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
dirlen = strlen(dir);
BUFCHECK(dirlen > buflen);
strcpy(buf, dir);
- free(dir);
+ xfree(dir);
SET_EXTERNAL_ENCODING();
}
#if defined DOSISH || defined __CYGWIN__
@@ -3726,7 +3726,7 @@ rb_stat_init(VALUE obj, VALUE fname)
rb_sys_fail(RSTRING_PTR(fname));
}
if (DATA_PTR(obj)) {
- free(DATA_PTR(obj));
+ xfree(DATA_PTR(obj));
DATA_PTR(obj) = NULL;
}
nst = ALLOC(struct stat);
@@ -3749,7 +3749,7 @@ rb_stat_init_copy(VALUE copy, VALUE orig)
rb_raise(rb_eTypeError, "wrong argument class");
}
if (DATA_PTR(copy)) {
- free(DATA_PTR(copy));
+ xfree(DATA_PTR(copy));
DATA_PTR(copy) = 0;
}
if (DATA_PTR(orig)) {
@@ -4373,7 +4373,7 @@ path_check_0(VALUE path, int execpath)
VALUE newpath;
newpath = rb_str_new2(buf);
- free(buf);
+ xfree(buf);
rb_str_cat2(newpath, "/");
rb_str_cat2(newpath, p0);