commit 8012de8076f8f6e7ef1fcc7f9cb29ba9e9e0df57
Author: Taylor R Campbell <[email protected]>
Date:   Wed Jun 17 18:05:10 2015 +0000

    Avoid potential null pointer dereferences in test_connection.
    
    Caught by clang static analyzer.
---
 tests/unit/test_connection.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/unit/test_connection.c b/tests/unit/test_connection.c
index 508e7db..800a75b 100644
--- a/tests/unit/test_connection.c
+++ b/tests/unit/test_connection.c
@@ -49,6 +49,9 @@ static void test_connection_usage(void)
                conn->dest_addr.domain == CONNECTION_DOMAIN_INET &&
                conn->refcount.count == 1,
                "Valid connection creation");
+       if (!conn) {
+               return;
+       }
 
        conn2 = connection_create(43, (struct sockaddr *) &c_addr.u.sin);
        ok(conn2 &&
@@ -56,6 +59,9 @@ static void test_connection_usage(void)
                conn2->dest_addr.domain == CONNECTION_DOMAIN_INET &&
                conn2->refcount.count == 1,
                "Valid second connection creation");
+       if (!conn2) {
+               return;
+       }
 
        connection_registry_lock();
        connection_insert(conn);



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to