summaryrefslogtreecommitdiff
path: root/prism/util/pm_string.c
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-03-07 11:02:00 -0500
committerKevin Newton <[email protected]>2024-03-07 18:02:33 -0500
commitc1462250b86519f48a03a2de98bb5222bb0ef169 (patch)
tree53e5ccbc18b91f32c002d1d740a7ad56a9f0ba91 /prism/util/pm_string.c
parent81f02eb6ba6104899035378f1f93b11448d44505 (diff)
[ruby/prism] Style and allocation functions
https://github.com/ruby/prism/commit/97f838c323
Diffstat (limited to 'prism/util/pm_string.c')
-rw-r--r--prism/util/pm_string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/prism/util/pm_string.c b/prism/util/pm_string.c
index 753429a233..8342edc34e 100644
--- a/prism/util/pm_string.c
+++ b/prism/util/pm_string.c
@@ -175,7 +175,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
}
// Create a buffer to read the file into.
- uint8_t *source = malloc(file_size);
+ uint8_t *source = xmalloc(file_size);
if (source == NULL) {
CloseHandle(file);
return false;
@@ -190,7 +190,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
// Check the number of bytes read
if (bytes_read != file_size) {
- free(source);
+ xfree(source);
CloseHandle(file);
return false;
}
@@ -220,7 +220,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
}
size_t length = (size_t) file_size;
- uint8_t *source = malloc(length);
+ uint8_t *source = xmalloc(length);
if (source == NULL) {
fclose(file);
return false;
@@ -231,7 +231,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
fclose(file);
if (bytes_read != 1) {
- free(source);
+ xfree(source);
return false;
}