From: Paul Eggert Date: Fri, 6 Jun 2025 06:35:33 +0000 (-0700) Subject: regex: fix resource leak when searching (ChangeLog entry) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76e3c05a1e6f342bf414ce72455470d5da019872;p=thirdparty%2Fgnulib.git regex: fix resource leak when searching (ChangeLog entry) --- diff --git a/ChangeLog b/ChangeLog index e811cb496d..b8590c159e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2025-06-05 Alec Brown (tiny change) + + regex: fix resource leak when searching + * lib/regex.c (merge_state_with_log): + In this function, memory is allocated for the variable next_nodes when + creating a union of the variables table_nodes and log_nodes. + However, if next_state->entrance_nodes is NULL, table_nodes becomes + NULL and we still allocate memory to copy the contents of log_nodes. + This can cause a resource leak since we only free the memory for + next_nodes if table_nodes isn't NULL. To prevent this, check that + next_state->entrance_nodes isn't NULL before allocating memory + for the union. + + This issue was found by a Coverity Scan of GRUB2 under the + following CID: CID: 473887 + 2025-06-05 Paul Eggert regex: fix some leaks when pattern compilation fails