summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-06-29 16:31:35 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-06-30 09:13:31 -0400
commit58386814a7c7275f66ffa111175fca2fe307a1b5 (patch)
tree56bfd1daec3a6d83dfda64b569de1b9fbbb4d23c /transcode.c
parent37a893d12915b8860f6880d6a0c2859e096ab4ff (diff)
Don't check for null pointer in calls to free
According to the C99 specification section 7.20.3.2 paragraph 2: > If ptr is a null pointer, no action occurs. So we do not need to check that the pointer is a null pointer.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8004
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/transcode.c b/transcode.c
index e6c4f85f83..b64768e48c 100644
--- a/transcode.c
+++ b/transcode.c
@@ -1715,8 +1715,7 @@ rb_econv_close(rb_econv_t *ec)
}
for (i = 0; i < ec->num_trans; i++) {
rb_transcoding_close(ec->elems[i].tc);
- if (ec->elems[i].out_buf_start)
- xfree(ec->elems[i].out_buf_start);
+ xfree(ec->elems[i].out_buf_start);
}
xfree(ec->in_buf_start);
xfree(ec->elems);