tp: fix missing status checks

This meant that we accidentally didn't throw errors when we should have

Change-Id: I90ae278205b38dc7ee27f368e4bd217aa8772f8e
diff --git a/src/trace_processor/iterator_impl.cc b/src/trace_processor/iterator_impl.cc
index 6539e9a..c0b3aac 100644
--- a/src/trace_processor/iterator_impl.cc
+++ b/src/trace_processor/iterator_impl.cc
@@ -34,7 +34,7 @@
       db_(db),
       stmt_(std::move(stmt)),
       column_count_(column_count),
-      status_(status),
+      status_(std::move(status)),
       sql_stats_row_(sql_stats_row) {}
 
 IteratorImpl::~IteratorImpl() {
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index e4fac8b..9db56c4 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -580,6 +580,7 @@
     if (it.Next()) {
       return util::ErrStatus("Unexpected result from a query.");
     }
+    RETURN_IF_ERROR(it.Status());
   }
   return util::OkStatus();
 }
@@ -600,6 +601,7 @@
     RETURN_IF_ERROR(it.Status());
     if (it.ColumnCount() == 0) {
       bool it_has_more = it.Next();
+      RETURN_IF_ERROR(it.Status());
       PERFETTO_DCHECK(!it_has_more);
       continue;
     }