add missing opencryptoki-3.19.0-fix-memory-leak.patch
This commit is contained in:
parent
aa8a7709a0
commit
c8a0d12ced
51
opencryptoki-3.19.0-fix-memory-leak.patch
Normal file
51
opencryptoki-3.19.0-fix-memory-leak.patch
Normal file
@ -0,0 +1,51 @@
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user