[Pkg-privacy-commits] [torsocks] 16/38: Avoid potential null pointer dereferences in test_connection.

Intrigeri intrigeri at moszumanska.debian.org
Thu Jun 23 15:18:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental/master
in repository torsocks.

commit 8012de8076f8f6e7ef1fcc7f9cb29ba9e9e0df57
Author: Taylor R Campbell <campbell+torsocks at mumble.net>
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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torsocks.git



More information about the Pkg-privacy-commits mailing list