Fix coverity issues 90/172190/3
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 12 Mar 2018 11:10:28 +0000 (20:10 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 13 Mar 2018 05:39:23 +0000 (14:39 +0900)
CID - 110313, 109044, 110513, 106918,
    106271, 105398, 107680, 105227, 110112

Change-Id: I665244c4adc8f2da8d1cf87d1a4bb8be5416dff3
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
download_db_service/download-db-service-main.cpp
src/download-manager-downloadItem.cpp
src/download-manager-notification.cpp
src/download-manager-viewItem.cpp

index f73bb32..13ed7ba 100755 (executable)
@@ -136,6 +136,7 @@ void DownloadHistoryDB::insert_request_cb(int request_id, data_control_h provide
 \r
        if (!openDB()) {\r
                DM_LOGE("NULL Check:historyDB");\r
+               free(command);\r
                return ;\r
        }\r
 \r
@@ -165,6 +166,7 @@ void DownloadHistoryDB::delete_request_cb(int request_id, data_control_h provide
 \r
        if (!openDB()) {\r
                DM_LOGE("NULL Check:historyDB");\r
+               free(command);\r
                return ;\r
        }\r
 \r
@@ -193,6 +195,7 @@ void DownloadHistoryDB::select_request_cb(int request_id, data_control_h provide
 \r
        if (!openDB()) {\r
                DM_LOGE("NULL Check:historyDB");\r
+               free(command);\r
                return ;\r
        }\r
 \r
@@ -218,6 +221,7 @@ void DownloadHistoryDB::update_request_cb(int request_id, data_control_h provide
 \r
        if (!openDB()) {\r
                DM_LOGE("NULL Check:historyDB");\r
+               free(command);\r
                return ;\r
        }\r
 \r
index 35f78d4..1d9a6d8 100755 (executable)
@@ -916,8 +916,10 @@ bool DownloadItem::retry(int id, unsigned long long fileSize)
        if (!m_registeredFilePath.empty())
                m_registeredFilePath.clear();
 #ifdef _ENABLE_OMA_DOWNLOAD
-       if (m_oma_item.get())
-               m_oma_item.release();
+       if (m_oma_item.get()) {
+               OmaItem *manual_pointer = m_oma_item.release();
+               delete manual_pointer;
+       }
 #endif
        return start(id);
 }
@@ -1084,7 +1086,7 @@ string OmaItem::getBytesStr(unsigned long long bytes)
                unitBytes = unitBytes >> 10;
        }
 
-       unitBytes = 1 << (10 * unit);
+       unitBytes = (unsigned long long)1 << (10 * unit);
        doubleTypeBytes = ((double)bytes / (double)(unitBytes));
        // FIXME following code should be broken into another function, but leave it now to save function call time.s
        char str[64] = {0};
index b6b536f..a5aee91 100755 (executable)
@@ -185,6 +185,7 @@ void DownloadNoti::addOngoingNoti()
                        DM_LOGE("Fail to set content [%d]", err);
                        freeNotiData(m_notiHandle);
                        m_notiHandle = NULL;
+                       freeNotiData(notiHandle);
                        return;
                }
        }
@@ -323,7 +324,7 @@ string DownloadNoti::convertSizeStr(unsigned long long size)
        for (unit = 0; (unitBytes > 1024 && unit < 4); unit++) {
                unitBytes = unitBytes >> 10;
        }
-       unitBytes = 1 << (10 * unit);
+       unitBytes = (unsigned long long)1 << (10 * unit);
 
        if (unit > 3)
                unit = 3;
index 08dc193..5906362 100755 (executable)
@@ -608,7 +608,7 @@ void ViewItem::getHumanFriendlyBytesStr(unsigned long long bytes,
                unitBytes = unitBytes >> 10;
        }
 
-       unitBytes = 1 << (10*unit);
+       unitBytes = (unsigned long long)1 << (10 * unit);
        doubleTypeBytes = ((double)bytes / (double)(unitBytes));
        // FIXME following code should be broken into another function, but leave it now to save function call time.s
        char str[64] = {0};