Merge "track_memory.sh should fail if its subcommand fails"
diff --git a/tools/track_memory.sh b/tools/track_memory.sh
index c0b4716..4629d4b 100755
--- a/tools/track_memory.sh
+++ b/tools/track_memory.sh
@@ -16,7 +16,7 @@
 
 function Exit {
   kill $lid
-  exit 0
+  exit $code
 }
 
 function Kill {
@@ -41,3 +41,4 @@
 trap "Exit" EXIT
 trap "Kill" SIGINT
 wait $pid
+code=$?