This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new c7f3918  Fixed ASAN issues with MMH test (#7868)
c7f3918 is described below

commit c7f391845d8910e4e3a7248641945b5f81e73d04
Author: Bryan Call <bc...@apache.org>
AuthorDate: Fri May 21 16:01:56 2021 -0700

    Fixed ASAN issues with MMH test (#7868)
---
 src/tscore/unit_tests/test_MMH.cc | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/tscore/unit_tests/test_MMH.cc 
b/src/tscore/unit_tests/test_MMH.cc
index cf53935..f8cf3aa 100644
--- a/src/tscore/unit_tests/test_MMH.cc
+++ b/src/tscore/unit_tests/test_MMH.cc
@@ -83,15 +83,18 @@ TEST_CASE("MMH", "[libts][MMH]")
       printf("********** collision %d\n", xy);
   }
 
-  unsigned char *s  = (unsigned char *)MMH_x;
-  int l             = sizeof(MMH_x);
-  unsigned char *s1 = (unsigned char *)ats_malloc(l + 3);
+  unsigned char *s       = (unsigned char *)MMH_x;
+  int l                  = sizeof(MMH_x);
+  unsigned char *s1      = (unsigned char *)ats_malloc(l + sizeof(uint32_t));
+  unsigned char *free_s1 = s1;
   s1 += 1;
   memcpy(s1, s, l);
-  unsigned char *s2 = (unsigned char *)ats_malloc(l + 3);
+  unsigned char *s2      = (unsigned char *)ats_malloc(l + sizeof(uint32_t));
+  unsigned char *free_s2 = s2;
   s2 += 2;
   memcpy(s2, s, l);
-  unsigned char *s3 = (unsigned char *)ats_malloc(l + 3);
+  unsigned char *s3      = (unsigned char *)ats_malloc(l + sizeof(uint32_t));
+  unsigned char *free_s3 = s3;
   s3 += 3;
   memcpy(s3, s, l);
 
@@ -136,4 +139,9 @@ TEST_CASE("MMH", "[libts][MMH]")
     if (!(z % 7))
       printf("\n");
   }
+  printf("\n");
+
+  ats_free(free_s1);
+  ats_free(free_s2);
+  ats_free(free_s3);
 }

Reply via email to