Skip to content

Commit

Permalink
Refs: #38
Browse files Browse the repository at this point in the history
Use stack variable for realloc() return value.
Fixes compilation with GCC 13.2.

Bump patch version to 1.0.2
  • Loading branch information
ayurchen committed May 2, 2024
1 parent 28f016a commit 32b357c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.50)
AC_INIT(glb, 1.0.1, info@codership.com)
AC_INIT(glb, 1.0.2, info@codership.com)
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_SRCDIR([src/glb_main.c])
AC_CONFIG_HEADER([config.h])
Expand Down
5 changes: 3 additions & 2 deletions src/glb_wdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ wdog_copy_result (wdog_dst_t* const d, double* const max_lat, int const lf)
if (others_len < res->others_len ||
others_len > (res->others_len * 2)) {
// buffer size is too different, reallocate
d->result.others = realloc (others, res->others_len);
if (!d->result.others && res->others_len > 0) {
void* const tmp = realloc (others, res->others_len);
if (!tmp && res->others_len > 0) {
// this is pretty much fatal, but we'll try
free (others);
d->result.others_len = 0;
Expand All @@ -339,6 +339,7 @@ wdog_copy_result (wdog_dst_t* const d, double* const max_lat, int const lf)
changed_length = true;
d->result.others_len = res->others_len;
}
d->result.others = tmp;
}

assert (d->result.others || 0 == d->result.others_len);
Expand Down

0 comments on commit 32b357c

Please sign in to comment.