From 4c5be8deb22752fad56cff9dd7b35e8d09e3042d Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 21 Apr 2017 20:30:12 +0200 Subject: [PATCH] vss: Add an assertion for vsst->header_buf. if vsst->header_len > 0 but vsst->header_buf is NULL, something weird is going on and non-obvious bad things will happen later. The assertion makes sure we notice early that there is a problem. It also silences a scan-build warning. --- vss.c | 1 + 1 file changed, 1 insertion(+) diff --git a/vss.c b/vss.c index 24dfc6bb..32e36a99 100644 --- a/vss.c +++ b/vss.c @@ -362,6 +362,7 @@ static void vss_get_chunk(int chunk_num, struct vss_task *vsst, * rather than the unmodified header (chunk zero). */ if (chunk_num == 0 && vsst->header_len > 0) { + assert(vsst->header_buf); *buf = vsst->header_buf; /* stripped header */ *sz = vsst->header_len; return; -- 2.39.5