about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-22 18:35:52 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-22 18:35:52 -0800
commit5f6c930472191efce6e8e810ad5ff0a362669b7a (patch)
tree15f969ae57f01124eaa7e48c49de9a185976dfa0
parentf17b34a8babcd5dc52482d2bddb08b65f62910e7 (diff)
downloadmu-5f6c930472191efce6e8e810ad5ff0a362669b7a.tar.gz
2689 - fix a memory leak
That same line that caused me so much grief in 2681!

I just ran edit/ through valgrind for the first time, and found more
memory leaks breeding while I wasn't looking. That's next.
-rw-r--r--059shape_shifting_recipe.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/059shape_shifting_recipe.cc b/059shape_shifting_recipe.cc
index 6e65e344..9de67a30 100644
--- a/059shape_shifting_recipe.cc
+++ b/059shape_shifting_recipe.cc
@@ -502,7 +502,7 @@ void ensure_all_concrete_types(/*const*/ recipe& new_recipe, const recipe& exemp
 void ensure_all_concrete_types(/*const*/ reagent& x, const recipe& exemplar) {
   if (!x.type || contains_type_ingredient_name(x.type)) {
     raise_error << maybe(exemplar.name) << "failed to map a type to " << x.original_string << '\n' << end();
-    x.type = new type_tree("", 0);  // just to prevent crashes later
+    if (!x.type) x.type = new type_tree("", 0);  // just to prevent crashes later
     return;
   }
   if (x.type->value == -1) {