[gnome-desktop] thumbnail: Don't crash if the thumbnailer could not be setup



commit b5a674a757d4ad934eb505f4e3c50ee1180f3693
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Aug 8 19:12:51 2017 +0200

    thumbnail: Don't crash if the thumbnailer could not be setup
    
    script_exec_new() can fail in certain cases, and we should not crash
    when trying to expand the script command later if the initial setup
    failed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785963

 libgnome-desktop/gnome-desktop-thumbnail-script.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail-script.c 
b/libgnome-desktop/gnome-desktop-thumbnail-script.c
index 5a5f05f..d9437d4 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail-script.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail-script.c
@@ -657,6 +657,9 @@ child_setup (gpointer user_data)
 static void
 script_exec_free (ScriptExec *exec)
 {
+  if (exec == NULL)
+    return;
+
   g_free (exec->infile);
   if (exec->outfile)
     {
@@ -757,6 +760,8 @@ gnome_desktop_thumbnail_script_exec (const char  *cmd,
   ScriptExec *exec;
 
   exec = script_exec_new (uri);
+  if (!exec)
+    goto out;
   expanded_script = expand_thumbnailing_cmd (cmd, exec, size, error);
   if (expanded_script == NULL)
     goto out;


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