From: Andre Noll Date: Fri, 21 Apr 2017 18:30:12 +0000 (+0200) Subject: vss: Add an assertion for vsst->header_buf. X-Git-Tag: v0.6.0~3 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=4c5be8deb22752fad56cff9dd7b35e8d09e3042d 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. --- 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;