diff --git a/net.c b/net.c
index 7a1b2df..ff6230c 100644
--- a/net.c
+++ b/net.c
@@ -1472,7 +1472,7 @@ static int net_socket_listen_init(VLANState *vlan,
     }
     s->vlan = vlan;
     s->model = strdup(model);
-    s->name = strdup(name);
+    s->name = name ? strdup(name) : NULL;
     s->fd = fd;
     qemu_set_fd_handler(fd, net_socket_accept, NULL, s);
     return 0;