[python] fix varobj crash

Tom Tromey tromey@redhat.com
Mon Aug 17 18:57:00 GMT 2009


I'm checking this in on the python branch.

This fixes a crash that Vladimir reported.
We shouldn't call value_incref on NULL.

Tom

2009-08-17  Tom Tromey  <tromey@redhat.com>

	* varobj.c (install_new_value): Conditionally call value_incref.

diff --git a/gdb/varobj.c b/gdb/varobj.c
index c8cf277..c64c628 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1518,7 +1518,8 @@ install_new_value (struct varobj *var, struct value *value, int initial)
   if (var->value != NULL && var->value != value)
     value_free (var->value);
   var->value = value;
-  value_incref (value);
+  if (value != NULL)
+    value_incref (value);
   if (var->print_value)
     xfree (var->print_value);
   var->print_value = print_value;



More information about the Archer mailing list