Blame SOURCES/opencryptoki-3.19.0-fix-memory-leak.patch

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