opencryptoki/opencryptoki-3.19.0-fix-memory-leak.patch
Than Ngo 15b0b2fb5c Resolves: #2126294, opencryptoki fails after generating > 500 RSA keys
Resolves: #2110314, rebase to 3.19.0
Resolves: #2110989, openCryptoki key generation with expected MKVP only on CCA and EP11 tokens
Resolves: #2110476, openCryptoki ep11 token: master key consistency
Resolves: #2018458, openCryptoki ep11 token: vendor specific key derivation
2022-10-11 20:27:20 +02:00

52 lines
1.7 KiB
Diff

commit cb4d7b125c7166602cb9094497a201b2f5a56985
Author: Ingo Franzki <ifranzki@linux.ibm.com>
Date: Tue Oct 4 13:21:32 2022 +0200
pkcsicsf: Fix memory leak
Use confignode_deepfree() to also free appended config nodes.
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
diff --git a/usr/sbin/pkcsicsf/pkcsicsf.c b/usr/sbin/pkcsicsf/pkcsicsf.c
index 44f5ef34..b02d1fe5 100644
--- a/usr/sbin/pkcsicsf/pkcsicsf.c
+++ b/usr/sbin/pkcsicsf/pkcsicsf.c
@@ -129,7 +129,8 @@ static void add_token_config_entry(struct ConfigIdxStructNode *s, char *key, cha
return;
v = confignode_allocstringvaldumpable(key, value, 0, NULL);
- confignode_append(s->value, &v->base);
+ if (v != NULL)
+ confignode_append(s->value, &v->base);
}
static int add_token_config(const char *configname,
@@ -150,7 +151,7 @@ static int add_token_config(const char *configname,
confignode_freeeoc(eoc1);
confignode_freeeoc(eoc2);
}
- confignode_freeidxstruct(s);
+ confignode_deepfree(&s->base);
fprintf(stderr, "Failed to add an entry for %s token\n", token.name);
return -1;
}
@@ -179,7 +180,7 @@ static int add_token_config(const char *configname,
if (tfp == NULL) {
fprintf(stderr, "fopen failed, line %d: %s\n",
__LINE__, strerror(errno));
- confignode_freeidxstruct(s);
+ confignode_deepfree(&s->base);
return -1;
}
@@ -188,7 +189,7 @@ static int add_token_config(const char *configname,
confignode_dump(tfp, &s->base, NULL, 2);
fclose(tfp);
- confignode_freeidxstruct(s);
+ confignode_deepfree(&s->base);
return 0;
}