summary refs log tree commit diff stats
path: root/net/socket.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-11-21 14:15:37 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-11-21 14:15:37 +0000
commit0e88f478508b566152c6681f4889ed9830a2c0a5 (patch)
tree0e6684291da7821000a2bd3e78e56b55af322242 /net/socket.c
parenta00c1173385741007f71ce505d092f4cc174f449 (diff)
parentb0af844007841609cc11fab58f838bd105cbe144 (diff)
downloadfocaccia-qemu-0e88f478508b566152c6681f4889ed9830a2c0a5.tar.gz
focaccia-qemu-0e88f478508b566152c6681f4889ed9830a2c0a5.zip
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
# gpg: Signature made Fri 21 Nov 2014 11:12:37 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  rtl8139: fix Pointer to local outside scope
  pcnet: fix Negative array index read
  net/socket: fix Uninitialized scalar variable
  net/slirp: fix memory leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/socket.c b/net/socket.c
index ca4b8ba2b3..68a93cd7e3 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -389,11 +389,6 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
 
     nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);
 
-    snprintf(nc->info_str, sizeof(nc->info_str),
-            "socket: fd=%d (%s mcast=%s:%d)",
-            fd, is_connected ? "cloned" : "",
-            inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
-
     s = DO_UPCAST(NetSocketState, nc, nc);
 
     s->fd = fd;
@@ -404,6 +399,12 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
     /* mcast: save bound address as dst */
     if (is_connected) {
         s->dgram_dst = saddr;
+        snprintf(nc->info_str, sizeof(nc->info_str),
+                 "socket: fd=%d (cloned mcast=%s:%d)",
+                 fd, inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
+    } else {
+        snprintf(nc->info_str, sizeof(nc->info_str),
+                 "socket: fd=%d", fd);
     }
 
     return s;