summaryrefslogtreecommitdiff
path: root/src/libpts/pts/pts_database.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpts/pts/pts_database.c')
-rw-r--r--src/libpts/pts/pts_database.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libpts/pts/pts_database.c b/src/libpts/pts/pts_database.c
index 07e8ae1da..fda644a6a 100644
--- a/src/libpts/pts/pts_database.c
+++ b/src/libpts/pts/pts_database.c
@@ -280,20 +280,17 @@ METHOD(pts_database_t, check_file_measurement, status_t,
DB_TEXT, dir, DB_INT);
if (!e)
{
- free(file);
- free(dir);
- return FAILED;
+ status = FAILED;
+ goto err;
}
dir_found = e->enumerate(e, &did);
e->destroy(e);
if (!dir_found)
{
- free(file);
- free(dir);
- return NOT_FOUND;
+ status = NOT_FOUND;
+ goto err;
}
-
e = this->db->query(this->db,
"SELECT fh.hash FROM file_hashes AS fh "
"JOIN files AS f ON f.id = fh.file "
@@ -302,12 +299,10 @@ METHOD(pts_database_t, check_file_measurement, status_t,
DB_TEXT, product, DB_INT, did, DB_TEXT, file, DB_INT, algo,
DB_BLOB);
}
- free(file);
- free(dir);
-
if (!e)
{
- return FAILED;
+ status = FAILED;
+ goto err;
}
while (e->enumerate(e, &hash))
{
@@ -324,6 +319,10 @@ METHOD(pts_database_t, check_file_measurement, status_t,
}
e->destroy(e);
+err:
+ free(file);
+ free(dir);
+
return status;
}