]> git.proxmox.com Git - qemu.git/commitdiff
slirp: Fix error reported by static code analysis
authorStefan Weil <sw@weilnetz.de>
Tue, 4 Sep 2012 21:20:36 +0000 (23:20 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 13 Sep 2012 10:38:14 +0000 (12:38 +0200)
Report from smatch:

slirp/tcp_subr.c:127 tcp_respond(17) error:
 we previously assumed 'tp' could be null (see line 124)

Return if 'tp' is NULL.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
slirp/tcp_subr.c

index 5890d7a827b4675a1086a0439909a6058b744b2d..1542e4361920ec1773c966cadf4f193ea3578783 100644 (file)
@@ -124,7 +124,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
        if (tp)
                win = sbspace(&tp->t_socket->so_rcv);
         if (m == NULL) {
-               if ((m = m_get(tp->t_socket->slirp)) == NULL)
+               if (!tp || (m = m_get(tp->t_socket->slirp)) == NULL)
                        return;
                tlen = 0;
                m->m_data += IF_MAXLINKHDR;