[gnome-shell] recorder: Fix memory leak
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] recorder: Fix memory leak
- Date: Tue, 28 Feb 2012 20:06:32 +0000 (UTC)
commit 550d5950340fb4e996dc91b51a5b8df5d518317e
Author: Adel Gadllah <adel gadllah gmail com>
Date: Tue Feb 28 21:01:49 2012 +0100
recorder: Fix memory leak
Don't leak path in recorder_open_outfile when the loop loops.
src/shell-recorder.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-recorder.c b/src/shell-recorder.c
index 85523f0..120ca0f 100644
--- a/src/shell-recorder.c
+++ b/src/shell-recorder.c
@@ -1182,7 +1182,6 @@ recorder_open_outfile (ShellRecorder *recorder)
const char *pattern;
int flags;
int outfile = -1;
- char *path = NULL;
recorder->count++;
@@ -1194,6 +1193,7 @@ recorder_open_outfile (ShellRecorder *recorder)
{
GString *filename = g_string_new (NULL);
const char *p;
+ char *path;
for (p = pattern; *p; p++)
{
@@ -1275,6 +1275,7 @@ recorder_open_outfile (ShellRecorder *recorder)
g_printerr ("Recording to %s\n", path);
g_string_free (filename, TRUE);
+ g_free (path);
goto out;
}
@@ -1283,6 +1284,7 @@ recorder_open_outfile (ShellRecorder *recorder)
{
g_warning ("Cannot open output file '%s': %s", filename->str, g_strerror (errno));
g_string_free (filename, TRUE);
+ g_free (path);
goto out;
}
@@ -1293,16 +1295,17 @@ recorder_open_outfile (ShellRecorder *recorder)
*/
g_warning ("Name collision with existing file for '%s'", filename->str);
g_string_free (filename, TRUE);
+ g_free (path);
goto out;
}
g_string_free (filename, TRUE);
+ g_free (path);
increment_unique (unique);
}
out:
- g_free (path);
if (outfile != -1)
recorder->unique = g_string_free (unique, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]