]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a leak-on-error case in 0.2.4 spotted by coverity
authorNick Mathewson <nickm@torproject.org>
Sat, 29 Dec 2012 03:57:00 +0000 (22:57 -0500)
committerNick Mathewson <nickm@torproject.org>
Sat, 29 Dec 2012 03:59:32 +0000 (22:59 -0500)
This one hits if the snprintf() fails when we're writing our IPv6
exit policy. It's new in 0.2.4.7-alpha. Part of bug 7816.

changes/bug7816.024 [new file with mode: 0644]
src/or/router.c

diff --git a/changes/bug7816.024 b/changes/bug7816.024
new file mode 100644 (file)
index 0000000..6ed6b74
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Avoid leaking IPv6 policy content if we fail to format it into
+      a router descriptor. Spotted by Coverity. Fixes part of 7816;
+      bugfix on 0.2.4.7-alpha.
index c7380cb444accea3bf9a385a54cebea8d980621e..e892ce0997b8d26add9acc6db13b4668e1ba570a 100644 (file)
@@ -2190,6 +2190,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
                             "ipv6-policy %s\n", p6);
       if (result<0) {
         log_warn(LD_BUG,"Descriptor printf of policy ran out of room");
+        tor_free(p6);
         return -1;
       }
       written += result;