]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a null-deref-on-fail in unit tests
authorNick Mathewson <nickm@torproject.org>
Mon, 11 Feb 2013 21:32:13 +0000 (16:32 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 11 Feb 2013 21:32:13 +0000 (16:32 -0500)
If geoip_format_bridge_stats() returned NULL when it should have
returned a string, we would have tried to deref NULL, and died.  Not
a big deal in the unit tests, but still worth fixing.

Found by coverity; This is CID 743384.

src/test/test.c

index be0737ceb7243ca09bf1a20ace5dd911414a3c31..6c64d35990f8c19cecd4cfe460bd000c99eff2d9 100644 (file)
@@ -1678,6 +1678,7 @@ test_geoip(void)
    * the connecting clients added above. */
   geoip_bridge_stats_init(now);
   s = geoip_format_bridge_stats(now + 86400);
+  test_assert(s);
   test_streq(bridge_stats_1, s);
   tor_free(s);