summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2017-03-17 13:54:15 +0100
committerOndrej Holy <oholy@redhat.com>2017-03-28 15:31:29 +0200
commit32378c1b098e4c61c938c849ac6593407dfcbba3 (patch)
treead4710f0431d020026d4069da4fa37e323e158d7
parentb8a233345d4781b61b78cf768d76be84f4d217ba (diff)
downloadgvfs-32378c1b098e4c61c938c849ac6593407dfcbba3.tar.gz
google: Prevent potential crashes if resolve_dir fails
Initialize pointers properly in order to avoid usage of unitialized, or already freed memory. This issues were revealed by coverity scan.
-rw-r--r--daemon/gvfsbackendgoogle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index 20853a45..9e709585 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -748,7 +748,7 @@ resolve_dir_and_rebuild (GVfsBackendGoogle *self,
GDataEntry *parent;
GDataEntry *ret_val = NULL;
GError *local_error;
- gchar *basename;
+ gchar *basename = NULL;
local_error = NULL;
parent = resolve_dir (self, filename, &basename, &local_error);
@@ -1184,6 +1184,7 @@ g_vfs_backend_google_copy (GVfsBackend *_self,
if (!destination_not_directory)
{
g_free (destination_basename);
+ destination_basename = NULL;
error = NULL;
destination_parent = resolve_dir (self, destination, &destination_basename, &error);