fix typo in previous commit
[deliverable/binutils-gdb.git] / gdb / varobj.c
index a2fd1c8bbd356d8ef1ed189b040f404bd2617365..1d8c8e8af54b14a9f7d3aa5e529053d79313fdf9 100644 (file)
@@ -433,7 +433,7 @@ varobj_create (char *objname,
     {
       char *p;
       enum varobj_languages lang;
-      struct value *value;
+      struct value *value = NULL;
 
       /* Parse and evaluate the expression, filling in as much
          of the variable's data as possible */
@@ -495,11 +495,15 @@ varobj_create (char *objname,
          If evaluate_expression succeeds we got the value we wanted.
          But if it fails, we still go on with a call to evaluate_type()  */
       if (!gdb_evaluate_expression (var->root->exp, &value))
-       /* Error getting the value.  Try to at least get the
-          right type.  */
-       value = evaluate_type (var->root->exp);
+       {
+         /* Error getting the value.  Try to at least get the
+            right type.  */
+         struct value *type_only_value = evaluate_type (var->root->exp);
+         var->type = value_type (type_only_value);
+       }
+      else 
+       var->type = value_type (value);
 
-      var->type = value_type (value);
       install_new_value (var, value, 1 /* Initial assignment */);
 
       /* Set language info */
@@ -1037,7 +1041,6 @@ int
 varobj_update (struct varobj **varp, struct varobj ***changelist)
 {
   int changed = 0;
-  int error = 0;
   int type_changed;
   int i;
   int vleft;
@@ -1051,13 +1054,10 @@ varobj_update (struct varobj **varp, struct varobj ***changelist)
   struct frame_info *fi;
 
   /* sanity check: have we been passed a pointer?  */
-  if (changelist == NULL)
-    return WRONG_PARAM;
+  gdb_assert (changelist);
 
-  /*  Only root variables can be updated...  */
   if (!is_root_p (*varp))
-    /* Not a root var.  */
-    return WRONG_PARAM;
+    error (_("Only root variables can be updated"));
 
   if (!(*varp)->root->is_valid)
     return INVALID;
@@ -1146,6 +1146,9 @@ varobj_update (struct varobj **varp, struct varobj ***changelist)
     }
   *cv = 0;
 
+  VEC_free (varobj_p, stack);
+  VEC_free (varobj_p, result);
+
   if (type_changed)
     return TYPE_CHANGED;
   else
This page took 0.025035 seconds and 4 git commands to generate.