]> granicus.if.org Git - libevent/commitdiff
Check return value of evbuffer_add_cb in tests
authorSebastian Hahn <sebastian@torproject.org>
Mon, 11 Apr 2011 16:26:48 +0000 (18:26 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Sat, 23 Apr 2011 00:04:58 +0000 (02:04 +0200)
Caught by clang's static analyzer

test/regress_buffer.c

index 4f4a83036e5bf77b173fa8b77ccd1eec0dd9de51..327210b0e204518473e8e5522731bd67ce6b58d1 100644 (file)
@@ -1140,7 +1140,9 @@ test_evbuffer_callbacks(void *ptr)
        evbuffer_drain(buf_out2, evbuffer_get_length(buf_out2));
        /* Let's test the obsolete buffer_setcb function too. */
        cb1 = evbuffer_add_cb(buf, log_change_callback, buf_out1);
+       tt_assert(cb1 != NULL);
        cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
+       tt_assert(cb2 != NULL);
        evbuffer_setcb(buf, self_draining_callback, NULL);
        evbuffer_add_printf(buf, "This should get drained right away.");
        tt_uint_op(evbuffer_get_length(buf), ==, 0);