Fix warnings from the Clang Static Analyzer.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 16 Nov 2015 13:33:39 +0000 (14:33 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 18 Jan 2016 14:59:22 +0000 (15:59 +0100)
These were all harmless.

src/avl_tree.c
src/net_packet.c
src/tincd.c

index 6b85516..f1645d5 100644 (file)
@@ -123,8 +123,6 @@ static void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
        avl_node_t *parent;
        avl_node_t **superparent;
 
-       parent = node;
-
        while(node) {
                parent = node->parent;
 
index e67857c..5ab08e2 100644 (file)
@@ -276,7 +276,7 @@ static void receive_udppacket(node_t *n, vpn_packet_t *inpkt) {
        vpn_packet_t pkt1, pkt2;
        vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 };
        int nextpkt = 0;
-       vpn_packet_t *outpkt = pkt[0];
+       vpn_packet_t *outpkt;
        int outlen, outpad;
        unsigned char hmac[EVP_MAX_MD_SIZE];
        int i;
index a2b3580..ed0cee9 100644 (file)
@@ -239,7 +239,8 @@ static bool parse_options(int argc, char **argv) {
                                        usage(true);
                                        return false;
                                }
-                               netname = strcmp(optarg, ".") != 0 ? xstrdup(optarg) : NULL;
+                               if(optarg && strcmp(optarg, "."))
+                                       netname = xstrdup(optarg);
                                break;
 
                        case 'o':                               /* option */