commit 5a927d1094dab529f8d1f02ee5104ed7155e12b4
parent bfb37f5b2e763a5e764f9c6d808339cf4fac7040
Author: Quentin Rameau <quinq@fifth.space>
Date: Sun, 22 May 2022 14:51:50 +0200
Pedantic strdup.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-restrict.c b/git-restrict.c
@@ -27,10 +27,10 @@ static void die(const char *msg)
static char *strdup(const char *s)
{
- size_t l = strlen(s);
- char *d = malloc(l+1);
+ size_t sz = strlen(s)+1;
+ char *d = malloc(sz);
if (!d) return NULL;
- return memcpy(d, s, l+1);
+ return memcpy(d, s, sz);
}
int main(int argc, char *argv[])