gbranden pushed a commit to branch master
in repository groff.

commit 089e7229427aac7bef2dd1fed0b73d161b5b1087
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Sep 17 18:36:23 2026 -0500

    [libbib,indxbib]: Fix Savannah #68703 (4/4).
    
    Fix mismatched memory allocation/deallocation techniques, which risks
    undefined behavior (UB) in C++.
    
    * src/utils/indxbib/indxbib.cpp (main): Deallocate local variable `dir`
      with free(3) rather than `delete[]`.
---
 ChangeLog                     | 2 ++
 src/utils/indxbib/indxbib.cpp | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 58224001c..50989842c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@
        * src/libs/libbib/index.cpp
        (index_search_item_iterator::~index_search_item_iterator):
        Deallocate `query` with free(3) rather than `delete[]`.
+       * src/utils/indxbib/indxbib.cpp (main): Deallocate local
+       variable `dir` with free(3) rather than `delete[]`.
 
 2026-09-12  G. Branden Robinson <[email protected]>
 
diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp
index 36df77915..de7f190f7 100644
--- a/src/utils/indxbib/indxbib.cpp
+++ b/src/utils/indxbib/indxbib.cpp
@@ -244,7 +244,7 @@ int main(int argc, char **argv)
     char *dir = strsave(base_name);
     dir[p - base_name] = '\0';
     name_max = file_name_max(dir);
-    delete[] dir;
+    free(dir);
   }
   else
     name_max = file_name_max(".");

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to