summaryrefslogtreecommitdiff
path: root/sysdeps/linux
diff options
context:
space:
mode:
authorBenoît Dejean <bdejean@src.gnome.org>2009-01-08 00:37:59 +0000
committerBenoît Dejean <bdejean@src.gnome.org>2009-01-08 00:37:59 +0000
commit77fff173fc1265efa9d787b792594cb378612ed5 (patch)
tree0ab1cf5f16c8ac8052167d62a9dfe7f1aa8d886c /sysdeps/linux
parent863da1cdfde87efb1acbdae357ef3d22636a8092 (diff)
downloadlibgtop-77fff173fc1265efa9d787b792594cb378612ed5.tar.gz
Fixed potential memory leak.
Patch by Vincent Untz <vuntz@gnome.org>. Closes #566611. svn path=/trunk/; revision=2787
Diffstat (limited to 'sysdeps/linux')
-rw-r--r--sysdeps/linux/fsusage.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sysdeps/linux/fsusage.c b/sysdeps/linux/fsusage.c
index 7afba2d5..559ba1f9 100644
--- a/sysdeps/linux/fsusage.c
+++ b/sysdeps/linux/fsusage.c
@@ -129,29 +129,29 @@ get_sys_path(glibtop* server, const char *device, char **stat_path, const char *
static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
{
- char *filename;
+ char *filename = NULL;
const char *format;
int ret;
char buffer[BUFSIZ];
char device[64];
if (!get_device(server, path, device, sizeof device))
- return;
+ goto out;
get_sys_path(server, device, &filename, &format);
ret = try_file_to_buffer(buffer, sizeof buffer, filename);
- if(ret < 0) return;
+ if (ret < 0) goto out;
if (sscanf(buffer, format, &buf->read, &buf->write) != 2) {
glibtop_warn_io_r(server, "Could not parse %s", filename);
- return;
+ goto out;
}
- g_free(filename);
-
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
+ out:
+ g_free(filename);
}