1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
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(®ex);
_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
|