diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2012-02-10 10:48:44 -0800 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2012-02-10 13:20:48 -0800 |
commit | 146edc2baad1388f49a7a857c2003faa171876c7 (patch) | |
tree | 55428f5c0dcf7ecefadaadfb68589982f63bf5b2 /test/eventcomm-test.c | |
parent | 49f6109032f2ce6171d1aad02672479d2c78c083 (diff) |
Allocate proto data in eventcomm-test
Provide a helper function for allocating proto data and use it in
eventcomm-test. This ensures a null pointer for priv->proto_data is not
dereferenced.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/eventcomm-test.c')
-rw-r--r-- | test/eventcomm-test.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/eventcomm-test.c b/test/eventcomm-test.c index 60fd0ef..c9d8888 100644 --- a/test/eventcomm-test.c +++ b/test/eventcomm-test.c @@ -135,6 +135,7 @@ test_read_hw_state(void) info.private = &private; info.fd = fd_read; + private.proto_data = EventProtoDataAlloc(); /* just the syn event */ reset_data(&hw, &comm); @@ -181,6 +182,8 @@ test_read_hw_state(void) /* the various buttons */ test_buttons(fd_write, &info, &hw, &comm); + + free(private.proto_data); } /** @@ -230,6 +233,8 @@ test_ignore_hw_state(void) info.private = &private; info.fd = fd_read; + private.proto_data = EventProtoDataAlloc(); + #define _assert_no_change(_type, _code) \ reset_data(&hw, &comm); \ ev.type = _type; \ @@ -273,6 +278,7 @@ test_ignore_hw_state(void) _assert_no_change(EV_KEY, i); } + free(private.proto_data); } int main (int argc, char **argv) |