From 5b0a2360fc643d9cc356592395fb2f2f80329401 Mon Sep 17 00:00:00 2001
From: Michael Tuexen <tuexen@fh-muenster.de>
Date: Sun, 8 Oct 2017 11:34:18 +0200
Subject: [PATCH] Fix CID 187661.

---
 gtests/net/packetdrill/run_system_call.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c
index 2d888120..3d3db7e9 100644
--- a/gtests/net/packetdrill/run_system_call.c
+++ b/gtests/net/packetdrill/run_system_call.c
@@ -4747,11 +4747,15 @@ static int sf_hdtr_new(struct expression *expression,
 	if (sf_hdtr_expr->headers != NULL) {
 		if (iovec_new(sf_hdtr_expr->headers, &sf_hdtr->headers, &iov_len, error))
 			goto error_out;
+	} else {
+		iov_len = 0;
 	}
 	if (sf_hdtr_expr->hdr_cnt != NULL) {
 		if (get_s32(sf_hdtr_expr->hdr_cnt, &s32_val, error))
 			goto error_out;
 		sf_hdtr->hdr_cnt = s32_val;
+	} else {
+		sf_hdtr->hdr_cnt = 0;
 	}
 	if (sf_hdtr->hdr_cnt != iov_len) {
 		asprintf(error,
@@ -4763,11 +4767,15 @@ static int sf_hdtr_new(struct expression *expression,
 	if (sf_hdtr_expr->trailers != NULL) {
 		if (iovec_new(sf_hdtr_expr->trailers, &sf_hdtr->trailers, &iov_len, error))
 			goto error_out;
+	} else {
+		iov_len = 0;
 	}
 	if (sf_hdtr_expr->trl_cnt != NULL) {
 		if (get_s32(sf_hdtr_expr->trl_cnt, &s32_val, error))
 			goto error_out;
 		sf_hdtr->trl_cnt = s32_val;
+	} else {
+		sf_hdtr->trl_cnt = 0;
 	}
 	if (sf_hdtr->trl_cnt != iov_len) {
 		asprintf(error,
-- 
GitLab