BUG/MINOR: stream: only free the req/res captures when set

There's a subtle bug in stream_free() when releasing captures. The
pools may be NULL when no capture is defined, and the calls to
pool_free() are inconditional. The only reason why this doesn't
cause trouble is because the pointer to be freed is always NULL in
this case and we don't go further down the chain. That's particularly
ugly and it complicates debugging, so let's only call these ones when
the pointers are set.

There's no impact on running code, it only fools those trying to debug
pools manually. There's no need to backport it though it unless it helps
for debugging sessions.
diff --git a/src/stream.c b/src/stream.c
index 5de7cdd..7df2cc6 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -672,16 +672,15 @@
 			struct cap_hdr *h;
 			for (h = fe->req_cap; h; h = h->next)
 				pool_free(h->pool, s->req_cap[h->index]);
+			pool_free(fe->req_cap_pool, s->req_cap);
 		}
 
 		if (s->res_cap) {
 			struct cap_hdr *h;
 			for (h = fe->rsp_cap; h; h = h->next)
 				pool_free(h->pool, s->res_cap[h->index]);
+			pool_free(fe->rsp_cap_pool, s->res_cap);
 		}
-
-		pool_free(fe->rsp_cap_pool, s->res_cap);
-		pool_free(fe->req_cap_pool, s->req_cap);
 	}
 
 	/* Cleanup all variable contexts. */