summaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
authorOnkar Palkar <onkar.palkar@wipro.com>2017-02-02 17:49:34 +0900
committerChristoph Lipka <clipka@jp.adit-jv.com>2017-02-06 11:51:52 +0900
commit859802afd10d159b9e370058bca53c8c12bba2f5 (patch)
treec0d21e00fb567120deac8f3911f8f958716f7e7a /src/console
parenta961dba0013ed2119aa719546c63212459753549 (diff)
downloadDLT-daemon-859802afd10d159b9e370058bca53c8c12bba2f5.tar.gz
dlt-client: fix dlt_client_cleanup memory handling
Setter function introduced for seting up string parameters which are free'd in dlt_client_cleanup Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
Diffstat (limited to 'src/console')
-rw-r--r--src/console/dlt-control-common.c6
-rw-r--r--src/console/dlt-control.c14
-rw-r--r--src/console/dlt-receive.c14
3 files changed, 26 insertions, 8 deletions
diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c
index 3973059..56a1795 100644
--- a/src/console/dlt-control-common.c
+++ b/src/console/dlt-control-common.c
@@ -479,7 +479,11 @@ static int dlt_control_init_connection(DltClient *client, void *cb)
if (dlt_parse_config_param("ControlSocketPath", &client->socketPath) != 0)
{
/* Failed to read from conf, copy default */
- client->socketPath = strdup(DLT_DAEMON_DEFAULT_CTRL_SOCK_PATH);
+ if(dlt_client_set_socket_path(client, DLT_DAEMON_DEFAULT_CTRL_SOCK_PATH) == -1)
+ {
+ pr_error("set socket path didn't succeed\n");
+ return -1;
+ }
}
client->mode = DLT_CLIENT_MODE_UNIX;
diff --git a/src/console/dlt-control.c b/src/console/dlt-control.c
index 8a66d0a..832343b 100644
--- a/src/console/dlt-control.c
+++ b/src/console/dlt-control.c
@@ -473,9 +473,12 @@ int main(int argc, char* argv[])
{
for (index = optind; index < argc; index++)
{
- g_dltclient.servIP = argv[index];
+ if(dlt_client_set_server_ip(&g_dltclient, argv[index]) == -1)
+ {
+ pr_error("set server ip didn't succeed\n");
+ return -1;
+ }
}
-
if (g_dltclient.servIP == 0)
{
/* no hostname selected, show usage and terminate */
@@ -489,9 +492,12 @@ int main(int argc, char* argv[])
{
for (index = optind; index < argc; index++)
{
- g_dltclient.serialDevice = argv[index];
+ if(dlt_client_set_serial_device(&g_dltclient, argv[index]) == -1)
+ {
+ pr_error("set serial device didn't succeed\n");
+ return -1;
+ }
}
-
if (g_dltclient.serialDevice == 0)
{
/* no serial device name selected, show usage and terminate */
diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c
index c10fab0..a4aef2e 100644
--- a/src/console/dlt-receive.c
+++ b/src/console/dlt-receive.c
@@ -442,7 +442,11 @@ int main(int argc, char* argv[])
{
for (index = optind; index < argc; index++)
{
- dltclient.servIP = argv[index];
+ if(dlt_client_set_server_ip(&dltclient, argv[index]) == -1)
+ {
+ fprintf(stderr,"set server ip didn't succeed\n");
+ return -1;
+ }
}
if (dltclient.servIP == 0)
@@ -458,7 +462,11 @@ int main(int argc, char* argv[])
{
for (index = optind; index < argc; index++)
{
- dltclient.serialDevice = argv[index];
+ if(dlt_client_set_serial_device(&dltclient, argv[index]) == -1)
+ {
+ fprintf(stderr,"set serial device didn't succeed\n");
+ return -1;
+ }
}
if (dltclient.serialDevice == 0)
@@ -469,7 +477,7 @@ int main(int argc, char* argv[])
return -1;
}
- dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
+ dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
}
/* initialise structure to use DLT file */