diff options
author | Monsta <[email protected]> | 2014-11-04 21:07:06 +0300 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-23 15:04:55 +0100 |
commit | 7eb0e133042c48e5e97303c44d56c1ddd9368290 (patch) | |
tree | 0eb585e16e8a40456b4da1f2eb5479997a760144 /src | |
parent | 11e38ad74f4be9733fc88bdebabb8f002445e1dc (diff) | |
download | mate-notification-daemon-7eb0e133042c48e5e97303c44d56c1ddd9368290.tar.bz2 mate-notification-daemon-7eb0e133042c48e5e97303c44d56c1ddd9368290.tar.xz |
don't leak memory
Diffstat (limited to 'src')
-rw-r--r-- | src/daemon/daemon.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 42c1aea..8ea1d6b 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -1077,8 +1077,9 @@ static void window_clicked_cb(GtkWindow* nw, GdkEventButton* button, NotifyDaemo static void url_clicked_cb(GtkWindow* nw, const char *url) { NotifyDaemon* daemon; - char* escaped_url; - char* cmd = NULL; + gchar *escaped_url; + gchar *cmd = NULL; + gchar *found = NULL; daemon = NW_GET_DAEMON(nw); @@ -1087,15 +1088,15 @@ static void url_clicked_cb(GtkWindow* nw, const char *url) escaped_url = g_shell_quote (url); - if (g_find_program_in_path ("gvfs-open") != NULL) + if ((found = g_find_program_in_path ("gvfs-open")) != NULL) { cmd = g_strdup_printf ("gvfs-open %s", escaped_url); } - else if (g_find_program_in_path ("xdg-open") != NULL) + else if ((found = g_find_program_in_path ("xdg-open")) != NULL) { cmd = g_strdup_printf ("xdg-open %s", escaped_url); } - else if (g_find_program_in_path ("firefox") != NULL) + else if ((found = g_find_program_in_path ("firefox")) != NULL) { cmd = g_strdup_printf ("firefox %s", escaped_url); } @@ -1104,6 +1105,7 @@ static void url_clicked_cb(GtkWindow* nw, const char *url) g_warning ("Unable to find a browser."); } + g_free (found); g_free (escaped_url); if (cmd != NULL) |