# Xfree or ruby\_xfree

**URL:** <https://www.ruby-forum.com/t/xfree-or-ruby-xfree/154181>\
**Category:** Development\
**Created:** [November 26, 2008, 7:46am UTC](https://www.ruby-forum.com/t/xfree-or-ruby-xfree/154181 "2008-11-26T07:46:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/77aa72/32.png) [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Post date:** [November 26, 2008, 7:46am UTC](https://www.ruby-forum.com/t/xfree-or-ruby-xfree/154181/1 "2008-11-26T07:46:51Z")

</div>

e$B@\>;3OB9-$G$9!#e(B

trunke$B$He(Bruby\_1\_8e$B$Ne(Bext/gdbm/gdbm.ce$B$Ne(Bdiffe$B$r$\_$?$H$-$Ke(Bfreee$B$He(Bxfreee$B$Ne(B  
e$B0c$$$,5$$K$J$C$?$N$G!"e(B  
[http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=17017](http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=17017)  
e$B$N0lIt$r%P%C%/%]!\<%H$7$h$&$+$H;W$C$?$N$G$9$,!"e(B  
xfreee$B$He(Bruby\_xfreee$B$O$I$&$$$&4p=`$G;H$$J,$1$F$$$k$N$G$7$g$&$+e(B?

e$B0J2\<!"8=\>u$N%Q%C%A$G$9!#e(B

# trunke$B$NJ}e(B: Index: ext/curses/curses.c

— ext/curses/curses.c (revision 20364)  
+++ ext/curses/curses.c (working copy)  
@@ -94,7 +94,7 @@  
{  
if (winp-\>window && winp-\>window != stdscr) delwin(winp-\>window);  
winp-\>window = 0;

- free(winp);

- xfree(winp);  
}

static VALUE

# ruby\_1\_8e$B$NJ}e(B: Index: ext/digest/digest.c

— ext/digest/digest.c (revision 20360)  
+++ ext/digest/digest.c (working copy)  
@@ -469,7 +469,7 @@  
pctx = xmalloc(algo-\>ctx\_size);  
algo-\>init\_func(pctx);

- obj = Data\_Wrap\_Struct(klass, 0, free, pctx);

- obj = Data\_Wrap\_Struct(klass, 0, xfree, pctx);

- free(dbmp);

- xfree(dbmp);  
}

# static VALUE Index: ext/zlib/zlib.c

— ext/zlib/zlib.c (revision 20360)  
+++ ext/zlib/zlib.c (working copy)  
@@ -410,7 +410,7 @@  
zlib\_mem\_free(opaque, address)  
voidpf opaque, address;  
{

- free(address);

- xfree(address);  
}

static void  
@@ -837,7 +837,7 @@  
if (ZSTREAM\_IS\_READY(z)) {  
zstream\_finalize(z);  
}

- free(z);

- xfree(z);  
}

static VALUE  
@@ -1776,7 +1776,7 @@  
}  
zstream\_finalize(z);  
}

- free(gz);

- xfree(gz);  
}

# static VALUE Index: ext/curses/curses.c

— ext/curses/curses.c (revision 20360)  
+++ ext/curses/curses.c (working copy)  
@@ -95,7 +95,7 @@  
{  
if (winp-\>window && winp-\>window != stdscr) delwin(winp-\>window);  
winp-\>window = 0;

- free(winp);

- xfree(winp);  
}

static VALUE  
@@ -672,7 +672,7 @@  
curses\_mousedata\_free(struct mousedata \*mdata)  
{  
if (mdata-\>mevent)

- free(mdata-\>mevent);

- xfree(mdata-\>mevent);  
}

# static VALUE Index: ext/openssl/ossl\_hmac.c

— ext/openssl/ossl\_hmac.c (revision 20360)  
+++ ext/openssl/ossl\_hmac.c (working copy)  
@@ -42,7 +42,7 @@  
ossl\_hmac\_free(HMAC\_CTX \*ctx)  
{  
HMAC\_CTX\_cleanup(ctx);

- free(ctx);

- xfree(ctx);  
}

# static VALUE Index: ext/openssl/ossl\_cipher.c

— ext/openssl/ossl\_cipher.c (revision 20360)  
+++ ext/openssl/ossl\_cipher.c (working copy)  
@@ -67,7 +67,7 @@  
{  
if (ctx) {  
EVP\_CIPHER\_CTX\_cleanup(ctx);

- free(ctx);

- xfree(ctx);  
}  
}

# Index: ext/openssl/ossl\_pkey\_ec.c

— ext/openssl/ossl\_pkey\_ec.c (revision 20360)  
+++ ext/openssl/ossl\_pkey\_ec.c (working copy)  
@@ -695,7 +695,7 @@  
{  
if (!ec\_group-\>dont\_free && ec\_group-\>group)  
EC\_GROUP\_clear\_free(ec\_group-\>group);

- free(ec\_group);

- xfree(ec\_group);  
}

static VALUE ossl\_ec\_group\_alloc(VALUE klass)  
@@ -1201,7 +1201,7 @@  
{  
if (!ec\_point-\>dont\_free && ec\_point-\>point)  
EC\_POINT\_clear\_free(ec\_point-\>point);

- free(ec\_point);

- xfree(ec\_point);  
}

# static VALUE ossl\_ec\_point\_alloc(VALUE klass) Index: ext/dbm/dbm.c

— ext/dbm/dbm.c (revision 20360)  
+++ ext/dbm/dbm.c (working copy)  
@@ -54,7 +54,7 @@  
{  
if (dbmp) {  
if (dbmp-\>di\_dbm) dbm\_close(dbmp-\>di\_dbm);

- free(dbmp);

- xfree(dbmp);  
}  
}

# Index: ext/gdbm/gdbm.c

— ext/gdbm/gdbm.c (revision 20361)  
+++ ext/gdbm/gdbm.c (working copy)  
@@ -113,7 +113,7 @@  
{  
if (dbmp) {  
if (dbmp-\>di\_dbm) gdbm\_close(dbmp-\>di\_dbm);

- 

```
   free(dbmp);

```

- 

```
   xfree(dbmp);

```

}  
}

# Index: ext/strscan/strscan.c

— ext/strscan/strscan.c (revision 20360)  
+++ ext/strscan/strscan.c (working copy)  
@@ -157,7 +157,7 @@  
strscan\_free(struct strscanner \*p)  
{  
re\_free\_registers(&(p-\>regs));

- free(p);

- xfree(p);  
}

static VALUE

---

<div class="post-metadata">

**Author:** ![Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/77aa72/32.png) [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Post date:** [November 26, 2008, 9:44am UTC](https://www.ruby-forum.com/t/xfree-or-ruby-xfree/154181/2 "2008-11-26T09:44:32Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37200] xfree or ruby\_xfree”  
on Wed, 26 Nov 2008 15:41:47 +0900, Kazuhiro NISHIYAMA  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|trunke$B$He(Bruby\_1\_8e$B$Ne(Bext/gdbm/gdbm.ce$B$Ne(Bdiffe$B$r$\_$?$H$-$Ke(Bfreee$B$He(Bxfreee$B$Ne(B  
|e$B0c$$$,5$$K$J$C$?$N$G!"e(B  
|[http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=17017](http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=17017)  
|e$B$N0lIt$r%P%C%/%]!\<%H$7$h$&$+$H;W$C$?$N$G$9$,!"e(B  
|xfreee$B$He(Bruby\_xfreee$B$O$I$&$$$&4p=`$G;H$$J,$1$F$$$k$N$G$7$g$&$+e(B?

e$B8=;~E@$G$O7k6I$I$l$be(Bfreee$B$r8F$s$G$$$k$N$GF1$8$J$N$G$9$,!"$5$5e(B  
e$B$@$5$s$O!Ve(Bmalloce$B$7$?4X?t$HBP1~$9$k$b$N$r;H$&!W$H$$$&J}?K$rDse(B  
e$B0F$7$F$\*$i$l$^$9!#$D$^$j!"e(B

malloce$B$He(Bfree  
xmalloce$B$He(Bxfree  
ruby\_xmalloce$B$He(Bruby\_xfree

e$B$NAH$\_9g$o$;$G$9!#e(B
