projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7de91ea
)
basic: use automatic cleanup more
author
David Tardon
<dtardon@redhat.com>
Thu, 10 May 2018 12:10:53 +0000
(14:10 +0200)
committer
David Tardon
<dtardon@redhat.com>
Thu, 10 May 2018 12:10:53 +0000
(14:10 +0200)
src/basic/strv.c
patch
|
blob
|
history
diff --git
a/src/basic/strv.c
b/src/basic/strv.c
index cb91f239e8a6e3d25d4e6cdf009bf53e6bc2fa45..47ab0ad07f1177ae51651a3526d185f1ff61cf00 100644
(file)
--- a/
src/basic/strv.c
+++ b/
src/basic/strv.c
@@
-121,7
+121,7
@@
size_t strv_length(char * const *l) {
char **strv_new_ap(const char *x, va_list ap) {
const char *s;
-
char **a
;
+
_cleanup_strv_free_ char **a = NULL
;
size_t n = 0, i = 0;
va_list aq;
@@
-152,7
+152,7
@@
char **strv_new_ap(const char *x, va_list ap) {
if (x != STRV_IGNORE) {
a[i] = strdup(x);
if (!a[i])
-
goto fail
;
+
return NULL
;
i++;
}
@@
-163,7
+163,7
@@
char **strv_new_ap(const char *x, va_list ap) {
a[i] = strdup(s);
if (!a[i])
-
goto fail
;
+
return NULL
;
i++;
}
@@
-171,11
+171,7
@@
char **strv_new_ap(const char *x, va_list ap) {
a[i] = NULL;
- return a;
-
-fail:
- strv_free(a);
- return NULL;
+ return TAKE_PTR(a);
}
char **strv_new(const char *x, ...) {