diff options
author | Joursoir <chat@joursoir.net> | 2022-09-08 12:09:00 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-09-08 12:12:37 +0300 |
commit | a8e27372d477e945febe7de5eccc458980304405 (patch) | |
tree | c4e3f866c26100ef9aa703efebd989071e90111e /src | |
parent | b935b6e43bcbb7616f4b6e0c769c008a7d58f06d (diff) | |
download | lock-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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); |