[grilo-plugins] podcasts: Fix crasher when DB could not be opened



commit 821748c1ab7685158545a931a06c093feba2bee0
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 8 18:06:53 2014 +0100

    podcasts: Fix crasher when DB could not be opened
    
    Don't try to close the database if it is invalid.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741258

 src/podcasts/grl-podcasts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c
index 055a49e..7f8a18a 100644
--- a/src/podcasts/grl-podcasts.c
+++ b/src/podcasts/grl-podcasts.c
@@ -383,6 +383,7 @@ grl_podcasts_source_init (GrlPodcastsSource *source)
     g_critical ("Failed to open database '%s': %s",
                db_path, sqlite3_errmsg (source->priv->db));
     sqlite3_close (source->priv->db);
+    source->priv->db = NULL;
     return;
   }
   GRL_DEBUG ("  OK");
@@ -404,6 +405,7 @@ grl_podcasts_source_init (GrlPodcastsSource *source)
       GRL_WARNING ("Failed to create database tables.");
     }
     sqlite3_close (source->priv->db);
+    source->priv->db = NULL;
     return;
   }
   GRL_DEBUG ("  OK");
@@ -422,7 +424,8 @@ grl_podcasts_source_finalize (GObject *object)
 
   g_clear_object (&source->priv->wc);
 
-  sqlite3_close (source->priv->db);
+  if (source->priv->db)
+    sqlite3_close (source->priv->db);
 
   G_OBJECT_CLASS (grl_podcasts_source_parent_class)->finalize (object);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]