From d46a8e8d941769fd62375880d6426cbb73ea4173 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Wed, 4 Jul 2018 23:23:32 +0100 Subject: [PATCH] dtcm: Coverity 88165 --- cde/programs/dtcm/libDtCmP/cm_tty.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cde/programs/dtcm/libDtCmP/cm_tty.c b/cde/programs/dtcm/libDtCmP/cm_tty.c index e7897bca..77590ed3 100644 --- a/cde/programs/dtcm/libDtCmP/cm_tty.c +++ b/cde/programs/dtcm/libDtCmP/cm_tty.c @@ -2186,10 +2186,12 @@ str_to_period(char *ps, CSA_sint32 *repeat_type, int *repeat_nth) { unit++; ps2 = cm_strdup(unit); ptr = strchr(ps2, ' '); - if (ptr != NULL) + if (ptr != NULL) { *ptr = '\0'; - else + } else { + free(ps2); return; + } ptr++; while (*ptr == ' ') -- 2.25.1