gbranden pushed a commit to branch master
in repository groff.

commit aeb33d8d139e7771830b7f799a801ee284f276bb
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Dec 23 21:08:21 2025 -0600

    src/roff/troff/node.cpp: Add `assert()`ion.
    
    * src/roff/troff/node.cpp (glyph_node::add_self): Initialize local
      pointer variable `nn` to `0`.  Before returning, `assert(3)` that it
      is no longer a null pointer.
---
 ChangeLog               | 6 ++++++
 src/roff/troff/node.cpp | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6b334adfe..a9aedf720 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-12-23  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/node.cpp (glyph_node::add_self): Initialize
+       local pointer variable `nn` to `0`.  Before returning,
+       `assert(3)` that it is no longer a null pointer.
+
 2025-12-23  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (token::is_usable_as_delimiter)
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index bae4c7415..769ea17ea 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2169,7 +2169,7 @@ node *glyph_node::add_self(node *n, hyphen_list **p)
 {
   assert(ci->get_hyphenation_code() == (*p)->hyphenation_code);
   next = 0 /* nullptr */;
-  node *nn;
+  node *nn = 0 /* nullptr */;
   if ((0 /* nullptr */ == n) ||
       (0 /* nullptr */ == (nn = n->merge_glyph_node(this)))) {
     next = n;
@@ -2180,6 +2180,7 @@ node *glyph_node::add_self(node *n, hyphen_list **p)
   hyphen_list *pp = *p;
   *p = (*p)->next;
   delete pp;
+  assert(nn != 0 /* nullptr */);
   return nn;
 }
 

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

Reply via email to