summaryrefslogtreecommitdiffstats
path: root/src/xregex.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-05-25 14:19:21 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-05-25 14:30:05 -0400
commit24a67ef8265e5873c0967ded296a9e57ed9f2914 (patch)
treeab48ef165aa5f83465b99354794787914f4dd9a9 /src/xregex.c
parenteef75524aec3910097cb6923c30b898ad98179fe (diff)
downloadbfs-24a67ef8265e5873c0967ded296a9e57ed9f2914.tar.xz
sanity: Add wrappers for sanitizer interfaces
Diffstat (limited to 'src/xregex.c')
-rw-r--r--src/xregex.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/xregex.c b/src/xregex.c
index 1143f23..ce59ff5 100644
--- a/src/xregex.c
+++ b/src/xregex.c
@@ -4,6 +4,7 @@
#include "xregex.h"
#include "config.h"
#include "diag.h"
+#include "sanity.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -175,13 +176,10 @@ int bfs_regcomp(struct bfs_regex **preg, const char *pattern, enum bfs_regex_typ
cflags |= REG_ICASE;
}
-#if __has_feature(memory_sanitizer)
- // https://github.com/google/sanitizers/issues/1496
- memset(&regex->impl, 0, sizeof(regex->impl));
-#endif
-
regex->err = regcomp(&regex->impl, pattern, cflags);
if (regex->err != 0) {
+ // https://github.com/google/sanitizers/issues/1496
+ sanitize_init(&regex->impl);
return -1;
}
#endif