From a814047c621b8bb7fa7e579557606e189ffd7e1d Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 07:32:31 +0000 Subject: Apply patch coverity2.patch patch_name: coverity2.patch present_in_specfile: true location_in_specfile: 7 --- diff --git a/src/compare_db.c b/src/compare_db.c index c17828d..dcd7cd4 100644 --- a/src/compare_db.c +++ b/src/compare_db.c @@ -438,7 +438,11 @@ snprintf(*values[0], l, "%s",s); } else { *values = malloc(1 * sizeof (char*)); if (DB_FTYPE&attr) { - easy_string(get_file_type_string(line->perm)) + char *file_type = get_file_type_string(line->perm); + if (!file_type) { + error(2,"%s: ", file_type); + } + easy_string(file_type) } else if (DB_LINKNAME&attr) { easy_string(line->linkname) easy_number((DB_SIZE|DB_SIZEG),size,"%li") diff --git a/src/db_file.c b/src/db_file.c index d30e9d1..c7265aa 100644 --- a/src/db_file.c +++ b/src/db_file.c @@ -194,6 +194,10 @@ int db_file_read_spec(int db){ *db_order=(DB_FIELD*) malloc(1*sizeof(DB_FIELD)); + if (*db_order == NULL){ + error(1,"malloc for *db_order failed in %s", __func__); + } + while ((i=db_scan())!=TNEWLINE){ switch (i) {