Mercurial > hg > th-libs
diff th_string.c @ 665:4932188c9101
Oops, missed one case of * sizeof(th_char_t).
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 Jan 2020 07:51:07 +0200 |
parents | 284d5b789b7c |
children | dfabc7eef3dd |
line wrap: on
line diff
--- a/th_string.c Mon Jan 27 07:48:27 2020 +0200 +++ b/th_string.c Mon Jan 27 07:51:07 2020 +0200 @@ -26,10 +26,10 @@ return NULL; len = strlen(src); - if ((res = th_malloc(len + 1)) == NULL) + if ((res = th_malloc((len + 1) * sizeof(th_char_t))) == NULL) return NULL; - memcpy(res, src, len + 1); + memcpy(res, src, (len + 1) * sizeof(th_char_t)); return res; }