]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix latent bug in gdbpy_lookup_static_symbols
authorTom Tromey <tom@tromey.com>
Sun, 15 Dec 2024 16:09:10 +0000 (09:09 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 20 Dec 2024 17:00:13 +0000 (10:00 -0700)
gdbpy_lookup_static_symbols is missing an error check for the case
where symbol_to_symbol_object returns NULL.

Approved-By: Tom de Vries <tdevries@suse.de>
gdb/python/py-symbol.c

index c1f8d6c95e0e31f654d36a5c5d74271c1f9f4d88..8648a5073d08a2e9025e269830483495dc17aec5 100644 (file)
@@ -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;
                    }
                }
            }