Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cpp/src/gandiva/precompiled/string_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2857,8 +2857,9 @@ const char* to_hex_binary(int64_t context, const char* text, int32_t text_len,
FORCE_INLINE
const char* to_hex_int64(int64_t context, int64_t data, int32_t* out_len) {
const int64_t hex_long_max_size = 2 * sizeof(int64_t);
auto ret =
reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, hex_long_max_size));
// Allocate one extra byte for the null terminator written by snprintf.
auto ret = reinterpret_cast<char*>(
gdv_fn_context_arena_malloc(context, hex_long_max_size + 1));

if (ret == nullptr) {
gdv_fn_context_set_error_msg(context, "Could not allocate memory for output string");
Expand All @@ -2874,7 +2875,8 @@ const char* to_hex_int64(int64_t context, int64_t data, int32_t* out_len) {
FORCE_INLINE
const char* to_hex_int32(int64_t context, int32_t data, int32_t* out_len) {
const int32_t max_size = 2 * sizeof(int32_t);
auto ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, max_size));
// Allocate one extra byte for the null terminator written by snprintf.
auto ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, max_size + 1));

if (ret == nullptr) {
gdv_fn_context_set_error_msg(context, "Could not allocate memory for output string");
Expand Down
Loading