aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-09-08 12:09:00 +0300
committerJoursoir <chat@joursoir.net>2022-09-08 12:12:37 +0300
commita8e27372d477e945febe7de5eccc458980304405 (patch)
treec4e3f866c26100ef9aa703efebd989071e90111e /src
parentb935b6e43bcbb7616f4b6e0c769c008a7d58f06d (diff)
downloadlock-password-a8e27372d477e945febe7de5eccc458980304405.tar.gz
lock-password-a8e27372d477e945febe7de5eccc458980304405.tar.bz2
lock-password-a8e27372d477e945febe7de5eccc458980304405.zip
xstd: move sizeof() into malloc()
Diffstat (limited to 'src')
-rw-r--r--src/xstd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xstd.c b/src/xstd.c
index f06f639..309412c 100644
--- a/src/xstd.c
+++ b/src/xstd.c
@@ -24,10 +24,10 @@
char *xstrcat(const char *first, const char *second,
const char *delimiter)
{
- size_t size = sizeof(char) * (strlen(first) + strlen(second) + 1);
+ size_t size = strlen(first) + strlen(second) + 1;
if(delimiter)
- size += sizeof(char) * strlen(delimiter);
- char *res = malloc(size);
+ size += strlen(delimiter);
+ char *res = malloc(size * sizeof(char));
strcpy(res, first);
if(delimiter)
strcat(res, delimiter);