summaryrefslogtreecommitdiff
path: root/src/examples/dlt-example-user-common-api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/dlt-example-user-common-api.c')
-rw-r--r--src/examples/dlt-example-user-common-api.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/examples/dlt-example-user-common-api.c b/src/examples/dlt-example-user-common-api.c
index 64ebd97..8404090 100644
--- a/src/examples/dlt-example-user-common-api.c
+++ b/src/examples/dlt-example-user-common-api.c
@@ -68,7 +68,7 @@ void usage()
{
char version[255];
- dlt_get_version(version);
+ dlt_get_version(version,255);
printf("Usage: dlt-example-common-api [options] message\n");
printf("Generate DLT messages and store them to file or send them to daemon.\n");
@@ -237,6 +237,12 @@ int main(int argc, char* argv[])
if (zvalue)
{
char* buffer = malloc(atoi(zvalue));
+ if(buffer==0)
+ {
+ /* no message, show usage and terminate */
+ fprintf(stderr,"Cannot allocate buffer memory!\n");
+ return -1;
+ }
DLT_LOG2(mycontext,DLT_LOG_WARN,DLT_STRING(text),DLT_RAW(buffer,atoi(zvalue)));
free(buffer);
}