[cheese/wip/fixes: 4/8] Fix some memory leaks in cheese_fileutil_init()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/wip/fixes: 4/8] Fix some memory leaks in cheese_fileutil_init()
- Date: Tue, 5 Nov 2013 23:58:48 +0000 (UTC)
commit ab137641572b0fdf1ee94a6b46211785ceb88535
Author: David King <amigadave amigadave com>
Date: Tue Nov 5 23:12:21 2013 +0000
Fix some memory leaks in cheese_fileutil_init()
libcheese/cheese-fileutil.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/libcheese/cheese-fileutil.c b/libcheese/cheese-fileutil.c
index 53c1f32..990b6d1 100644
--- a/libcheese/cheese-fileutil.c
+++ b/libcheese/cheese-fileutil.c
@@ -257,29 +257,36 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
settings = g_settings_new ("org.gnome.Cheese");
- g_settings_get (settings, "video-path", "s", &priv->video_path);
- g_settings_get (settings, "photo-path", "s", &priv->photo_path);
+ priv->video_path = g_settings_get_string (settings, "video-path");
+ priv->photo_path = g_settings_get_string (settings, "photo-path");
/* get the video path from gsettings, xdg or hardcoded */
- if (!priv->video_path || strcmp (priv->video_path, "") == 0)
+ if (!priv->video_path || (*priv->video_path == '\0'))
{
+ g_free (priv->video_path);
+
/* get xdg */
priv->video_path = g_build_filename (g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS), "Webcam", NULL);
- if (strcmp (priv->video_path, "") == 0)
+ if (priv->video_path == '\0')
{
+ g_free (priv->video_path);
+
/* get "~/.gnome2/cheese/media" */
priv->video_path = cheese_fileutil_get_path_before_224 (fileutil);
}
}
/* get the photo path from gsettings, xdg or hardcoded */
- if (!priv->photo_path || strcmp (priv->photo_path, "") == 0)
+ if (!priv->photo_path || (*priv->photo_path == '\0'))
{
+ g_free (priv->photo_path);
+
/* get xdg */
priv->photo_path = g_build_filename (g_get_user_special_dir (G_USER_DIRECTORY_PICTURES), "Webcam", NULL);
- if (strcmp (priv->photo_path, "") == 0)
+ if (priv->photo_path == '\0')
{
/* get "~/.gnome2/cheese/media" */
+ g_free (priv->photo_path);
priv->photo_path = cheese_fileutil_get_path_before_224 (fileutil);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]