cmdparse: don't duplicate hostname in CPS_ParseNTPSourceAdd()

Let the caller duplicate the string if needed.
This commit is contained in:
Miroslav Lichvar
2014-09-24 12:41:38 +02:00
parent 336473398a
commit d466390233
3 changed files with 4 additions and 21 deletions

View File

@@ -971,11 +971,9 @@ process_cmd_add_server_or_peer(CMD_Request *msg, char *line)
switch (status) {
case CPS_Success:
if (DNS_Name2IPAddress(data.name, &ip_addr) != DNS_Success) {
free(data.name);
fprintf(stderr, "Invalid host/IP address\n");
break;
}
free(data.name);
if (data.params.min_stratum != SRC_DEFAULT_MINSTRATUM) {
fprintf(stderr, "Option minstratum not supported\n");