[gnome-system-monitor] Backout change from using free() to g_free() in systemd patch
- From: Chris KÃhl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Backout change from using free() to g_free() in systemd patch
- Date: Sat, 14 Jan 2012 02:24:55 +0000 (UTC)
commit f1f7bddf007c950608f5f8c5a771a7fb2ab187d5
Author: Chris KÃhl <chrisk openismus com>
Date: Sat Jan 14 03:18:22 2012 +0100
Backout change from using free() to g_free() in systemd patch
From Lennart: Ahum, the free() calls (instead of g_free()) were
actually placed there for a reason: the memory is allocated by
sd_pid_get_session() and friends -- which allocate their memory with
malloc(), and not g_malloc(). In the normal case the backend of
g_malloc() will simply be malloc(), however if people use
g_mem_set_vtable() this might differ. i.e. you may use g_free() and
free() only then interchangably if g_mem_is_system_malloc() is
TRUE. Summary: replacing free() by g_free() will work most of the
times but is incorrect.
src/proctable.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 2f33b37..8897c24 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -510,9 +510,12 @@ ProcInfo::~ProcInfo()
g_free(this->arguments);
g_free(this->security_context);
g_free(this->cgroup_name);
- g_free(this->unit);
- g_free(this->session);
- g_free(this->seat);
+ // The following are allocated inside of the sd_pid_get_*
+ // functions using malloc(). Free with free() instead of g_free()
+ // to insure proper clean up.
+ free(this->unit);
+ free(this->session);
+ free(this->seat);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]