]> granicus.if.org Git - transmission/commitdiff
Handle two more cases where dirname/basename may have returned NULL (adds to 91f8ceb20d)
authorMike Gelfand <mikedld@mikedld.com>
Mon, 16 Jan 2017 23:21:47 +0000 (02:21 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Mon, 16 Jan 2017 23:22:31 +0000 (02:22 +0300)
libtransmission/platform.c
libtransmission/session.c

index 2743c8e7d715c3b04edf45f68e141fdc10a4800a..3a7eed86cd25c5f8e60ca87e378921006eadc296 100644 (file)
@@ -516,12 +516,15 @@ tr_getWebClientDir (const tr_session * session UNUSED)
                 module_path = tr_win32_native_to_utf8 (wide_module_path, -1);
                 dir = tr_sys_path_dirname (module_path, NULL);
                 tr_free (module_path);
-                s = tr_buildPath (dir, "Web", NULL);
-                tr_free (dir);
-                if (!isWebClientDir (s))
+                if (dir != NULL)
                   {
-                    tr_free (s);
-                    s = NULL;
+                    s = tr_buildPath (dir, "Web", NULL);
+                    tr_free (dir);
+                    if (!isWebClientDir (s))
+                      {
+                        tr_free (s);
+                        s = NULL;
+                      }
                   }
             }
 
index f21d18e20fb90efbbf9b4e5cefb763e4f7a19a04..944dde2ad1ce495dc979d17a12dfb3cb93049845 100644 (file)
@@ -2304,12 +2304,10 @@ loadBlocklists (tr_session * session)
       else
         {
           char * binname;
-          char * basename;
           tr_sys_path_info path_info;
           tr_sys_path_info binname_info;
 
-          basename = tr_sys_path_basename (name, NULL);
-          binname = tr_strdup_printf ("%s" TR_PATH_DELIMITER_STR "%s.bin", dirname, basename);
+          binname = tr_strdup_printf ("%s" TR_PATH_DELIMITER_STR "%s.bin", dirname, name);
 
           if (!tr_sys_path_get_info (binname, 0, &binname_info, NULL)) /* create it */
             {
@@ -2344,7 +2342,6 @@ loadBlocklists (tr_session * session)
               tr_free (old);
             }
 
-          tr_free (basename);
           tr_free (binname);
         }