diff options
author | Jens Freimann <jfreimann@redhat.com> | 2017-11-06 15:05:46 +0100 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2017-12-06 09:43:29 -0600 |
commit | 957bd48acfc350fd9b05669fb55cb61b004dd7bb (patch) | |
tree | 4e90bcfbdfff22cc1b9cdb2139c0c755cb54c470 | |
parent | 3a82a03a2e671ad23865fed273d5baf19790e037 (diff) | |
download | qemu-957bd48acfc350fd9b05669fb55cb61b004dd7bb.tar.gz |
net/socket: fix coverity issue
This fixes coverity issue CID1005339.
Make sure that saddr is not used uninitialized if the
mcast parameter is NULL.
Cc: qemu-stable@nongnu.org
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit bb160b571fe469b03228d4502c75a18045978a74)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | net/socket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c index 18af2ab5f3..6664a75aa4 100644 --- a/net/socket.c +++ b/net/socket.c @@ -369,7 +369,7 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, net_socket_read_poll(s, true); /* mcast: save bound address as dst */ - if (is_connected) { + if (is_connected && mcast != NULL) { s->dgram_dst = saddr; snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d (cloned mcast=%s:%d)", |