]> git.meshlink.io Git - meshlink/commitdiff
Fix a few small memory leaks.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 3 Dec 2011 20:59:47 +0000 (21:59 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 3 Dec 2011 20:59:47 +0000 (21:59 +0100)
src/protocol_key.c
src/subnet.c
src/tincd.c

index f34ebaa585a64ec21416aaab565ba976c7f9d793..a7d4447a9a08d40b70c48b53e5bb8c71a24314ab 100644 (file)
@@ -242,8 +242,6 @@ bool ans_key_h(connection_t *c) {
 
        /* Update our copy of the origin's packet key */
        from->outkey = xrealloc(from->outkey, strlen(key) / 2);
-
-       from->outkey = xstrdup(key);
        from->outkeylength = strlen(key) / 2;
        hex2bin(key, from->outkey, from->outkeylength);
 
index 47f14366c10127b1d30f488eea79662e5bb85836..7fffe633c4ce377aeae9400c1536a00d20980c80 100644 (file)
@@ -468,6 +468,8 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
                // 4 and 5 are reserved for SUBNET and WEIGHT
                xasprintf(&envp[6], "REMOTEADDRESS=%s", address);
                xasprintf(&envp[7], "REMOTEPORT=%s", port);
+               free(port);
+               free(address);
        }
 
        name = up ? "subnet-up" : "subnet-down";
index b3d911b8f61f2fdc1b2cf1732ba0e2072e2f0e55..f075168d2df5de2890b6218bffa4e9e650dfcdc8 100644 (file)
@@ -612,7 +612,7 @@ int main2(int argc, char **argv) {
 
        /* Change process priority */
 
-        char *priority = 0;
+        char *priority = NULL;
 
         if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) {
                 if(!strcasecmp(priority, "Normal")) {
@@ -661,6 +661,8 @@ end:
        remove_pid(pidfilename);
 #endif
 
+       free(priority);
+
        EVP_cleanup();
        ENGINE_cleanup();
        CRYPTO_cleanup_all_ex_data();
@@ -668,6 +670,7 @@ end:
        ERR_free_strings();
 
        exit_configuration(&config_tree);
+       list_free(cmdline_conf);
        free_names();
 
        return status;