summaryrefslogtreecommitdiff
path: root/src/timesync
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-27 03:01:06 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 13:45:53 +0100
commitb5efdb8af40ea759a1ea584c1bc44ecc81dd00ce (patch)
tree8b8b3411e13a6c92d59e1b071b910aa6c44c7495 /src/timesync
parent7d50b32a129e781401cf897475f388f682de1368 (diff)
util-lib: split out allocation calls into alloc-util.[ch]
Diffstat (limited to 'src/timesync')
-rw-r--r--src/timesync/timesyncd-conf.c5
-rw-r--r--src/timesync/timesyncd-manager.c1
-rw-r--r--src/timesync/timesyncd-server.c1
3 files changed, 5 insertions, 2 deletions
diff --git a/src/timesync/timesyncd-conf.c b/src/timesync/timesyncd-conf.c
index ad6fd180e4..be651fc636 100644
--- a/src/timesync/timesyncd-conf.c
+++ b/src/timesync/timesyncd-conf.c
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "alloc-util.h"
#include "string-util.h"
#include "timesyncd-manager.h"
#include "timesyncd-server.h"
@@ -35,16 +36,16 @@ int manager_parse_server_string(Manager *m, ServerType type, const char *string)
first = type == SERVER_FALLBACK ? m->fallback_servers : m->system_servers;
for (;;) {
- _cleanup_free_ char *word;
+ _cleanup_free_ char *word = NULL;
bool found = false;
ServerName *n;
r = extract_first_word(&string, &word, NULL, 0);
if (r < 0)
return log_error_errno(r, "Failed to parse timesyncd server syntax \"%s\": %m", string);
-
if (r == 0)
break;
+
/* Filter out duplicates */
LIST_FOREACH(names, n, first)
if (streq_ptr(n->string, word)) {
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index 15ca006deb..b4995c3064 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -33,6 +33,7 @@
#include "sd-daemon.h"
+#include "alloc-util.h"
#include "fd-util.h"
#include "fs-util.h"
#include "list.h"
diff --git a/src/timesync/timesyncd-server.c b/src/timesync/timesyncd-server.c
index ec3fe1fc4e..f98e6b4cf0 100644
--- a/src/timesync/timesyncd-server.c
+++ b/src/timesync/timesyncd-server.c
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "alloc-util.h"
#include "timesyncd-server.h"
int server_address_new(