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 6b8551655e37189265fa54c019b515397b2e4c3b..f1645d52da71c71a7f9e8d66cc2e7f80125819ef 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 e67857cc4865b6c60d2d52ee6c36a47d44dbf011..5ab08e24a9d44ce12bc2e6b26b4fb2e49dd2bacc 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 a2b358052f7f17c072399ebc35e17ab344dc17bd..ed0cee9374253e756cca5fa301c19a98e6e0d1ed 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 */