auth: Avoid double free in key parsing
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 12 Feb 2013 12:59:08 +0000 (12:59 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 21 Feb 2013 17:09:49 +0000 (09:09 -0800)
There was an error path whilst reading an extended key file which could
result in a key being freed using free(key), and then freed again
through the afsconf_typedKey_put() mechanism. Remove this double free.

Caught by clang-analyzer

Change-Id: I40bff56eddf4cb499ae5b7effdaf82f22379109d
Reviewed-on: http://gerrit.openafs.org/9147
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/auth/keys.c

index 9bfa67a..d3731c6 100644 (file)
@@ -522,7 +522,6 @@ _parseExtendedKeyFile(struct afsconf_dir *dir, char *fileName)
        code = read(fd, key->key.val, reclen);
        if (code != reclen) {
            rx_opaque_freeContents(&key->key);
-           free(key);
            goto fail;
        }
        code = addMemoryKey(dir, key, 1);