sock: fix a uninitialized-variable error

Valgrind reports error "epoll_ctl(event) points to uninitiazlized
byte(s)" when running unit test. Fix it by initializing variable event
to a known state.

Change-Id: I756687c1077eeb632c045c316a76714aa453b918
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453525
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Richael Zhuang 2019-05-07 19:01:16 +08:00 committed by Jim Harris
parent fa0005d41a
commit 09a782dcff
2 changed files with 2 additions and 0 deletions

View File

@ -506,6 +506,7 @@ spdk_posix_sock_group_impl_add_sock(struct spdk_sock_group_impl *_group, struct
#if defined(__linux__)
struct epoll_event event;
memset(&event, 0, sizeof(event));
event.events = EPOLLIN;
event.data.ptr = sock;

View File

@ -557,6 +557,7 @@ spdk_vpp_sock_group_impl_add_sock(struct spdk_sock_group_impl *_group, struct sp
assert(group != NULL);
assert(g_vpp_initialized);
memset(&event, 0, sizeof(event));
event.events = EPOLLIN;
event.data.ptr = sock;