dtcm: Coverity 88165
authorPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 22:23:32 +0000 (23:23 +0100)
committerPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 22:23:32 +0000 (23:23 +0100)
cde/programs/dtcm/libDtCmP/cm_tty.c

index e7897bca1694008b38128514511978f88936257d..77590ed36b98523763e0c4f07de9886f7ee8c41a 100644 (file)
@@ -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 == ' ')