[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-dev] Patch to remove goto from sandbox.c



-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Hi,

I changed a function in sandbox.c to not use a goto statement. I didn't
understood what use it had. Attached the patch file.

I did the usual tests and didn't found any error at first and second glance.
Please consider to test it yourself and if fit include it into production.

best regards
Hartmut

PS: I try to remove some more gotos, if this patch is ok.

- -- 
Ideas are the only things that can change the world.
The rest is details. -- Scott Adams

https://netzpolitik.org/2013/anleitung-so-verschlusselt-ihr-eure-e-mails-mit-pgp/
new Key ID since 26.07.13: 0xD8C361E6
Fingerprint: E5B3 302B 1BE1 D0B4 F190 E739 A365 60A9 D8C3 61E6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAwAGBQJTEgcdAAoJEKNlYKnYw2Hm9CwP/37Jijgz4By5Au/xkzWUiUWr
gRPNTswPZNKhZotgWNYvxQ3SJjhI0pKdFZicX3XUIMUCVJ5wFNT/4Edq3QdDsNGk
CorJ+J/UcuzpCQomqJ+zOj6Av+pNSe6/Nbpf8NOgNjAhF1fsqQNQb2/IuSwmqppy
YbVl8noNLk6cEb283xLWjwIVNPPTi1Nj0jDFh25ZVxGYcICkDUG6jDjhHNCAZJgG
mQEbvq6kBNeh5qX7KPmxhI7fSBh6kTFTLWxLAbYXJQFugqf1ho7T/ULFNOEFDu3e
edijtSfk1ysJ0bd9UoUfkD5cJ4fralgIH8mXhlntOxJpwL640g7Gla/bIpsiwrPW
XnBGM+qUrhd1HMLZVyVGBAysz+AIOFGYBSC4ZBGG4r2hDStakFHUJ5pNLJYY6EbA
NAh03yf8XtPnCM17dojBXvQK1KEXsl0St4ChcERp0uq1v/7d3MLNtM+h1iGhFacT
YQyUuZvbvaRoQp7bQUdLjnlRZHhGySwQnzU1T1hY3dxp/182GAGy/SxaWdG+NNsi
mVcxLJedzxm4Fx+cARPHLYDU3xPM7EPYSa81eOEUrniVJYx1LiacDSoVRlhfRQiU
+8mEs/eaOJJzaooSq/msYiTfFRh4bAu999nk+VHUo+9m9cjjp0sfzPSGNaBkg7dP
BLKg6P6uM8sDlOd3yZ4b
=g1L7
-----END PGP SIGNATURE-----

Attachment: 0xD8C361E6.asc
Description: application/pgp-keys

diff --git src/common/sandbox.c src/common/sandbox.c
index 6b78748..d8db324 100644
--- src/common/sandbox.c
+++ src/common/sandbox.c
@@ -1202,14 +1202,11 @@ sandbox_add_addrinfo(const char* name)
     log_err(LD_BUG,"(Sandbox) failed to getaddrinfo");
     ret = -2;
     tor_free(el);
-    goto out;
-  }
-
-  el->name = tor_strdup(name);
-  el->next = sb_addr_info;
-  sb_addr_info = el;
-
- out:
+  } else {
+    el->name = tor_strdup(name);
+    el->next = sb_addr_info;
+    sb_addr_info = el;
+  } 
   return ret;
 }
 

Attachment: 0xD8C361E6.asc.sig
Description: PGP signature

Attachment: sandbox-goto.patch.sig
Description: PGP signature

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev