fixes for part of errors found using clang checker and coverity

"make check" was ok.

full scan reports here:
https://www.dropbox.com/s/7w9zx8mg3d5c8tb/static_analyze_report.zip?dl=0
you can try to solve remaining errors.
In this case function does not replace all the allocated space, and garbage (or maybe your private key is sent to the network)
This is report from real run:
Dr. Memory version 1.7.0 build 5 built on Apr  4 2014 23:38:05
Dr. Memory results for pid 12676: "utox.exe"
Application cmdline: "D:\utox\utox.exe"
Recorded 104 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin\suppress-default.txt

Error UNINITIALIZED READ: reading 0x042af5f6-0x042af602 12 byte(s) within 0x042af5a8-0x042af73b
0 system call NtDeviceIoControlFile AFD_SEND_INFO_UDP.BufferArray[i].buf
1 MSWSOCK.dll!?                                                             +0x0      (0x73b82930 <MSWSOCK.dll+0x2930>)
2 WS2_32.dll!sendto                                                         +0x81     (0x75ca3537 <WS2_32.dll+0x3537>)
3 sendpacket                                                                 [../toxcore/network.c:340]
4 send_onion_packet_tcp_udp.isra.0                                           [../toxcore/onion_client.c:234]
5 client_send_announce_request                                               [../toxcore/onion_client.c:356]
6 do_onion_client                                                            [../toxcore/onion_client.c:1256]