diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/strv.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c index eea34ca68d..24fc56a1a5 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -721,7 +721,7 @@ int strv_make_nulstr(char * const *l, char **ret, size_t *ret_size) { } if (!m) { - m = new0(char, 1); + m = new0(char, 2); if (!m) return -ENOMEM; n = 1; @@ -730,11 +730,9 @@ int strv_make_nulstr(char * const *l, char **ret, size_t *ret_size) { m[n] = '\0'; assert(n > 0); - *ret = m; + *ret = TAKE_PTR(m); *ret_size = n - 1; - m = NULL; - return 0; } |