]> git.meshlink.io Git - utcp/blobdiff - utcp.c
Fix check for return value of malloc().
[utcp] / utcp.c
diff --git a/utcp.c b/utcp.c
index 7624aa576d39c8753c810cea4c4f8643c377d3d4..ce056904169c6923baa95a0e5435626e5da75fd5 100644 (file)
--- a/utcp.c
+++ b/utcp.c
@@ -282,7 +282,12 @@ static struct utcp_connection *allocate_connection(struct utcp *utcp, uint16_t s
 
        c->src = src;
        c->dst = dst;
+#ifdef UTCP_DEBUG
+#warning debugging
+       c->snd.iss = 0;
+#else
        c->snd.iss = rand();
+#endif
        c->snd.una = c->snd.iss;
        c->snd.nxt = c->snd.iss + 1;
        c->rcv.wnd = utcp->mtu;
@@ -360,7 +365,7 @@ static void ack(struct utcp_connection *c, bool sendatleastone) {
        } *pkt;
 
        pkt = malloc(sizeof pkt->hdr + c->utcp->mtu);
-       if(!pkt->data)
+       if(!pkt)
                return;
 
        pkt->hdr.src = c->src;