From f124cfaf46dbe45547a850319c5c749ea1778e0e Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 30 Aug 2013 09:12:22 -0400 Subject: [PATCH] Return values checking for tox_array_push_ptr in Lossless UDP. --- toxcore/Lossless_UDP.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c index 070f5231..b9987804 100644 --- a/toxcore/Lossless_UDP.c +++ b/toxcore/Lossless_UDP.c @@ -106,7 +106,9 @@ int new_connection(Lossless_UDP *ludp, IP_Port ip_port) } if (connection_id == -1) { - tox_array_push_ptr(&ludp->connections, 0); /* TODO: check return value */ + if (tox_array_push_ptr(&ludp->connections, 0) == 0) + return -1; + connection_id = ludp->connections.len - 1; } @@ -156,7 +158,9 @@ static int new_inconnection(Lossless_UDP *ludp, IP_Port ip_port) } if (connection_id == -1) { - tox_array_push_ptr(&ludp->connections, 0); /* TODO: check return value */ + if (tox_array_push_ptr(&ludp->connections, 0) == 0) + return -1; + connection_id = ludp->connections.len - 1; }