diff options
author | Mark Karpilovskij <mark.karpilovskij@nic.cz> | 2019-02-22 15:08:11 +0100 |
---|---|---|
committer | Mark Karpilovskij <mark.karpilovskij@nic.cz> | 2019-02-22 15:08:11 +0100 |
commit | 5b9fc945f4dea71562d69500c23fcd044f3d993c (patch) | |
tree | 5940a47881175b4ac3995a9edc42f1fffad5c756 | |
parent | journal: move include pthread.h from .c to .h (diff) | |
download | knot-5b9fc945f4dea71562d69500c23fcd044f3d993c.tar.xz knot-5b9fc945f4dea71562d69500c23fcd044f3d993c.zip |
keystore: fix leak in pkcs8 import
-rw-r--r-- | src/libdnssec/keystore/pkcs8.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libdnssec/keystore/pkcs8.c b/src/libdnssec/keystore/pkcs8.c index d7948dd5b..fb9b12381 100644 --- a/src/libdnssec/keystore/pkcs8.c +++ b/src/libdnssec/keystore/pkcs8.c @@ -355,6 +355,7 @@ static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr r = key_open_write(handle->dir_name, id, &file); if (r != DNSSEC_EOK) { if (key_is_duplicate(r, handle, id, pem)) { + *id_ptr = id; return DNSSEC_EOK; } return r; @@ -364,6 +365,7 @@ static int pkcs8_import_key(void *ctx, const dnssec_binary_t *pem, char **id_ptr ssize_t wrote_count = write(file, pem->data, pem->size); if (wrote_count == -1) { + free(id); return dnssec_errno_to_error(errno); } |