Fix static analysis issue 40/183040/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 2 Jul 2018 02:43:22 +0000 (11:43 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 2 Jul 2018 02:44:43 +0000 (11:44 +0900)
Change-Id: Ib1cffbc442d78e9b5cd8fd4f9f875d627ca65e41
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkg_initdb/pkg_initdb.cc

index 613d79dc1607573d52144e595fd318e650b291e3..615044a80c2dcf841b2896af20389a96365cb4d1 100644 (file)
@@ -116,6 +116,11 @@ void RemoveOldDatabases(uid_t uid) {
     std::cerr << info_db_journal_path << " is not removed" << std::endl;
   if (IsGlobal(uid)) {
     char *cert_db = getUserPkgCertDBPath();
+    if (!cert_db) {
+      std::cerr << "Failed to get cert db path" << std::endl;
+      free(parser_db);
+      return;
+    }
     std::string cert_db_journal = cert_db + journal;
     bf::path cert_db_path(cert_db);
     bf::path cert_db_journal_path(cert_db_journal.c_str());