X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=crypt.c;h=207ad5db4e9f264091076d404adb06e12b95e8e4;hb=d740f34f84a830ff18c845103731a1a5a52fc1af;hp=f064fb3a535d9df3306818d7e9c27ca85193bd50;hpb=82d08fb6da4dfc7d93d1ee0cce4706721378fe12;p=paraslash.git diff --git a/crypt.c b/crypt.c index f064fb3a..207ad5db 100644 --- a/crypt.c +++ b/crypt.c @@ -184,27 +184,28 @@ int get_asymmetric_key(const char *key_file, int private, PARA_INFO_LOG("decoding public rsa-ssh key %s\n", key_file); ret = -ERRNO_TO_PARA_ERROR(EOVERFLOW); if (map_size > INT_MAX / 4) - goto out; + goto out_unmap; blob_size = 2 * map_size; blob = para_malloc(blob_size); ret = uudecode(cp, blob, blob_size); if (ret < 0) - goto out; + goto out_unmap; decoded_size = ret; ret = check_ssh_key_header(blob, decoded_size); if (ret < 0) - goto out; + goto out_unmap; ret = read_rsa_bignums(blob + ret, decoded_size - ret, &key->rsa); if (ret < 0) - goto out; + goto out_unmap; ret = RSA_size(key->rsa); -out: +out_unmap: ret2 = para_munmap(map, map_size); if (ret >= 0 && ret2 < 0) ret = ret2; +out: if (ret < 0) { free(key); - result = NULL; + *result = NULL; PARA_ERROR_LOG("key %s: %s\n", key_file, para_strerror(-ret)); } else *result = key;