[PATCH] Fix latent bug in gdbpy_lookup_static_symbols
Tom Tromey
tom@tromey.com
Thu Dec 19 23:31:11 GMT 2024
gdbpy_lookup_static_symbols is missing an error check for the case
where symbol_to_symbol_object returns NULL.
---
gdb/python/py-symbol.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index c1f8d6c95e0..8648a5073d0 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -632,10 +632,11 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
if (symbol != nullptr)
{
- PyObject *sym_obj
- = symbol_to_symbol_object (symbol);
+ PyObject *sym_obj = symbol_to_symbol_object (symbol);
+ if (sym_obj == nullptr)
+ return nullptr;
if (PyList_Append (return_list.get (), sym_obj) == -1)
- return NULL;
+ return nullptr;
}
}
}
--
2.46.1
More information about the Gdb-patches
mailing list