From 6ca8c2a0c00577c04f3df5b03fc327525fba579d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 May 2014 02:07:42 +0200 Subject: do not duplicate interception condition string before it is necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-server/mds-server.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c index 93849ff..5f5eb10 100644 --- a/src/mds-server/mds-server.c +++ b/src/mds-server/mds-server.c @@ -1022,12 +1022,6 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority size_t hash; size_t i; - if ((condition = strdup(condition)) == NULL) - { - perror(*argv); - return; - } - /* Split header and value apart. */ if ((value = strchr(header, ':')) != NULL) { @@ -1094,6 +1088,13 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority eprint("client tried to stop intercepting messages that it does not intercept."); else { + /* Duplicate condition string. */ + if ((condition = strdup(condition)) == NULL) + { + perror(*argv); + return; + } + /* Grow the interception condition list. */ if (conds == NULL) conds = malloc(1 * sizeof(interception_condition_t)); -- cgit v1.2.3-70-g09d2