chiark / gitweb /
bootchart: add assert
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 18 Jun 2014 21:35:01 +0000 (23:35 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 18 Jun 2014 22:18:05 +0000 (00:18 +0200)
since 376cd3b89c62f580a6f576cecfbbb28d3944118f LIST_FIND_TAIL accepts
an empty list. That removed an assert in LIST_FIND_TAIL and we now
theoretically risk a null pointer deref. This adds the assert directly
to protect against that.

src/bootchart/svg.c

index 81211995292761140f3a9aa7daf90fd8895d7408..bf6636cab1d8c26b0c2f9d12a2baac7869faf863 100644 (file)
@@ -80,6 +80,8 @@ static void svg_header(void) {
         double h;
         struct list_sample_data *sampledata_last;
 
+        assert(head);
+
         sampledata = head;
         LIST_FIND_TAIL(link, sampledata, head);
         sampledata_last = head;