summaryrefslogtreecommitdiff
path: root/sntp/libevent/test/regress_zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sntp/libevent/test/regress_zlib.c')
-rw-r--r--sntp/libevent/test/regress_zlib.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sntp/libevent/test/regress_zlib.c b/sntp/libevent/test/regress_zlib.c
index 9339397..8406676 100644
--- a/sntp/libevent/test/regress_zlib.c
+++ b/sntp/libevent/test/regress_zlib.c
@@ -56,6 +56,7 @@
#include "event2/bufferevent.h"
#include "regress.h"
+#include "mm-internal.h"
/* zlib 1.2.4 and 1.2.5 do some "clever" things with macros. Instead of
saying "(defined(FOO) ? FOO : 0)" they like to say "FOO-0", on the theory
@@ -95,6 +96,7 @@ zlib_deflate_free(void *ctx)
z_streamp p = ctx;
assert(deflateEnd(p) == Z_OK);
+ mm_free(p);
}
static void
@@ -103,6 +105,7 @@ zlib_inflate_free(void *ctx)
z_streamp p = ctx;
assert(inflateEnd(p) == Z_OK);
+ mm_free(p);
}
static int
@@ -275,7 +278,7 @@ test_bufferevent_zlib(void *arg)
{
struct bufferevent *bev1=NULL, *bev2=NULL;
char buffer[8333];
- z_stream z_input, z_output;
+ z_stream *z_input, *z_output;
int i, r;
evutil_socket_t pair[2] = {-1, -1};
(void)arg;
@@ -293,18 +296,18 @@ test_bufferevent_zlib(void *arg)
bev1 = bufferevent_socket_new(NULL, pair[0], 0);
bev2 = bufferevent_socket_new(NULL, pair[1], 0);
- memset(&z_output, 0, sizeof(z_output));
- r = deflateInit(&z_output, Z_DEFAULT_COMPRESSION);
+ z_output = mm_calloc(sizeof(*z_output), 1);
+ r = deflateInit(z_output, Z_DEFAULT_COMPRESSION);
tt_int_op(r, ==, Z_OK);
- memset(&z_input, 0, sizeof(z_input));
- r = inflateInit(&z_input);
+ z_input = mm_calloc(sizeof(*z_input), 1);
+ r = inflateInit(z_input);
tt_int_op(r, ==, Z_OK);
/* initialize filters */
bev1 = bufferevent_filter_new(bev1, NULL, zlib_output_filter,
- BEV_OPT_CLOSE_ON_FREE, zlib_deflate_free, &z_output);
+ BEV_OPT_CLOSE_ON_FREE, zlib_deflate_free, z_output);
bev2 = bufferevent_filter_new(bev2, zlib_input_filter,
- NULL, BEV_OPT_CLOSE_ON_FREE, zlib_inflate_free, &z_input);
+ NULL, BEV_OPT_CLOSE_ON_FREE, zlib_inflate_free, z_input);
bufferevent_setcb(bev1, readcb, writecb, errorcb, NULL);
bufferevent_setcb(bev2, readcb, writecb, errorcb, NULL);