dtcm: Coverity 89169
authorPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 19:14:18 +0000 (20:14 +0100)
committerPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 19:14:18 +0000 (20:14 +0100)
cde/programs/dtcm/server/parser.y

index a89ff0ebe57baf19be4e5caf0cc62e1c8e5ad0b6..1095f2de8d6c1cd62564b4aa90595c3abd0ee245 100644 (file)
@@ -1080,7 +1080,7 @@ static CSA_return_code
 get_date_time_list_value(char *valstr, cms_attribute_value **attrval)
 {
        char *ptr;
-       CSA_date_time_entry *a, *head, *prev;
+       CSA_date_time_entry *a = NULL, *head, *prev;
        CSA_return_code stat = CSA_SUCCESS;
        cms_attribute_value *val;
 
@@ -1123,8 +1123,10 @@ get_date_time_list_value(char *valstr, cms_attribute_value **attrval)
                                head = a;
                        else
                                prev->next = a;
-               } else
+               } else {
+                       free(a);
                        stat = CSA_E_INSUFFICIENT_MEMORY;
+               }
        }
 
        if (stat == CSA_SUCCESS) {