libgtop r2788 - branches/gnome-2-24/sysdeps/linux
- From: bdejean svn gnome org
- To: svn-commits-list gnome org
- Subject: libgtop r2788 - branches/gnome-2-24/sysdeps/linux
- Date: Sun, 11 Jan 2009 22:59:11 +0000 (UTC)
Author: bdejean
Date: Sun Jan 11 22:59:11 2009
New Revision: 2788
URL: http://svn.gnome.org/viewvc/libgtop?rev=2788&view=rev
Log:
Fixed potential memory leak.
Patch by Vincent Untz <vuntz gnome org>.
Closes #566611.
Modified:
branches/gnome-2-24/sysdeps/linux/fsusage.c
Modified: branches/gnome-2-24/sysdeps/linux/fsusage.c
==============================================================================
--- branches/gnome-2-24/sysdeps/linux/fsusage.c (original)
+++ branches/gnome-2-24/sysdeps/linux/fsusage.c Sun Jan 11 22:59:11 2009
@@ -129,29 +129,29 @@
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]