Skip to content

Commit 0c3593b

Browse files
committed
Use free with ruby_dtoa
In ae0ceaf ruby_dtoa was switched to use malloc instead of xmalloc, which means that consumers should be using free instead of xfree. Otherwise we will artificially shrink oldmalloc_increase_bytes.
1 parent 5f81f58 commit 0c3593b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

marshal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ w_float(double d, struct dump_arg *arg)
466466
memcpy(buf + len, p, digs);
467467
len += digs;
468468
}
469-
xfree(p);
469+
free(p);
470470
w_bytes(buf, len, arg);
471471
}
472472
}

numeric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ flo_to_s(VALUE flt)
10781078
s = sign ? rb_usascii_str_new_cstr("-") : rb_usascii_str_new(0, 0);
10791079
if ((digs = (int)(e - p)) >= (int)sizeof(buf)) digs = (int)sizeof(buf) - 1;
10801080
memcpy(buf, p, digs);
1081-
xfree(p);
1081+
free(p);
10821082
if (decpt > 0) {
10831083
if (decpt < digs) {
10841084
memmove(buf + decpt + 1, buf + decpt, digs - decpt);

vsnprintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,8 +1255,8 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *l
12551255
}
12561256
buf[0] = 0; /* rve - digits may be 0 */
12571257
memcpy(buf, digits, rve - digits);
1258-
xfree(digits);
12591258
rve = buf + (rve - digits);
1259+
free(digits);
12601260
digits = buf;
12611261
if (flags & ALT) { /* Print trailing zeros */
12621262
bp = digits + ndigits;

0 commit comments

Comments
 (0)