aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2021-03-02 10:01:26 +0100
committerQuentin Carbonneaux <[email protected]>2021-03-02 10:01:26 +0100
commit99c8f84efc280265d026737b2bdfd4741c8a74e8 (patch)
tree5fe0b0d0d3b5ada0e52d666c96443725572363d4 /util.c
parent4e81cc2f8a28ba168b446dbbd24a3877e6837da9 (diff)
fix a couple asan complaints
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index f1a5383..0123e27 100644
--- a/util.c
+++ b/util.c
@@ -246,13 +246,15 @@ void
idup(Ins **pd, Ins *s, ulong n)
{
*pd = alloc(n * sizeof(Ins));
- memcpy(*pd, s, n * sizeof(Ins));
+ if (n)
+ memcpy(*pd, s, n * sizeof(Ins));
}
Ins *
icpy(Ins *d, Ins *s, ulong n)
{
- memcpy(d, s, n * sizeof(Ins));
+ if (n)
+ memcpy(d, s, n * sizeof(Ins));
return d + n;
}