aboutsummaryrefslogblamecommitdiffstats
path: root/testing/radsecproxy/0001-fix-memory-allocation-in-t_rewrite_config-fix-71.patch
blob: af07c29f7b8820131286bdde8431c53249820b08 (plain) (tree)























































                                                                                 
From 7151b71afb2dfc748ed2ca7c124e271b4f390206 Mon Sep 17 00:00:00 2001
From: Fabian Mauchle <mauchle@macfma.switch.ch>
Date: Fri, 4 Sep 2020 13:08:54 +0200
Subject: [PATCH] fix memory allocation in t_rewrite_config (fix #71)

---
 tests/t_rewrite.c        | 1 +
 tests/t_rewrite_config.c | 6 ++----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/t_rewrite.c b/tests/t_rewrite.c
index 80d6bee..184accf 100644
--- a/tests/t_rewrite.c
+++ b/tests/t_rewrite.c
@@ -685,6 +685,7 @@ main (int argc, char *argv[])
             printf("not ");
         printf("ok %d - issue #62\n", testcount++);
 
+        regfree(&regex);
         _tlv_list_clear(origattrs);
         _tlv_list_clear(expectedattrs);
         _reset_rewrite(&rewrite);
diff --git a/tests/t_rewrite_config.c b/tests/t_rewrite_config.c
index 129bbbd..6d3f043 100644
--- a/tests/t_rewrite_config.c
+++ b/tests/t_rewrite_config.c
@@ -23,7 +23,7 @@ main (int argc, char *argv[])
     numtests = 1;
 
     {
-        addattrs = malloc(2);
+        addattrs = malloc(2*sizeof(char*));
         addattrs[0] = stringcopy("1:'1%00%001%41%2541", 0);
         addattrs[1] = NULL;
 
@@ -55,7 +55,7 @@ main (int argc, char *argv[])
     /* test issue #62 */
     {
         char *expectreplace = "\\1=86400";
-        char **modvattrs = malloc(2);
+        char **modvattrs = malloc(2*sizeof(char*));
         rewritename= "issue62";
 
         modvattrs[0] = stringcopy("9:102:/^(h323-credit-time).*$/\\1=86400/",0);
@@ -79,8 +79,6 @@ main (int argc, char *argv[])
         } else {
             printf("not ok %d - rewrite config issue #62\n", numtests++);
         }
-
-        free(modvattrs);
     }
 
     return 0;
-- 
2.28.0