Fix svace issue (WGID 309818)
[platform/core/telephony/tel-plugin-database.git] / src / database_main.c
index a96c5ae..0cf2801 100644 (file)
@@ -28,6 +28,7 @@
 #include <db-util.h>
 
 #include <tcore.h>
+#include <server.h>
 #include <plugin.h>
 #include <storage.h>
 
@@ -367,8 +368,20 @@ static gboolean on_init(TcorePlugin *p)
 
 static void on_unload(TcorePlugin *p)
 {
+       Storage *strg;
+
+       if (!p)
+               return;
+
        dbg("i'm unload!");
+
+       strg = tcore_server_find_storage(tcore_plugin_ref_server(p), "database");
+       if (!strg)
+               return;
+
+       tcore_storage_free(strg);
        return;
+
 }
 
 EXPORT_API struct tcore_plugin_define_desc plugin_define_desc = {