chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6187030
)
basic: use automatic cleanup more
author
David Tardon
<dtardon@redhat.com>
Thu, 10 May 2018 12:10:53 +0000
(14:10 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000
(16:47 +0200)
src/basic/strv.c
patch
|
blob
|
history
diff --git
a/src/basic/strv.c
b/src/basic/strv.c
index 5620558bf4ae7c38ca967069813b835e530f3543..0c2d1c8488af606934fb7492be379c0a9491585b 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, ...) {