[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] update_pid_entries(): fix awkwardly indented uninitialized m
From: |
Jeremie Koenig |
Subject: |
[PATCH 2/5] update_pid_entries(): fix awkwardly indented uninitialized memory leak |
Date: |
Mon, 16 Aug 2010 13:36:49 +0200 |
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
---
procfs_pid_files.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/procfs_pid_files.c b/procfs_pid_files.c
index 9dbe3eb..3008145 100644
--- a/procfs_pid_files.c
+++ b/procfs_pid_files.c
@@ -46,14 +46,12 @@ update_pid_entries (struct procfs_dir *dir, const char
*name,
time_t timestamp,
const char *symlink_target)
{
- struct procfs_dir_entry *dir_entry;
- struct stat *stat = (struct stat *) malloc (sizeof (struct stat));
- stat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
+ struct stat stat;
- dir_entry = update_entries_list (dir, name, stat,
- timestamp, symlink_target);
+ memset (&stat, 0, sizeof stat);
+ stat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
- return dir_entry;
+ return update_entries_list (dir, name, &stat, timestamp, symlink_target);
}
/* Creates files to store process information for DIR
--
1.7.1
Updated procfs series, Jeremie Koenig, 2010/08/16
[PATCH 1/5] Fix /proc/*/cmdline, Jeremie Koenig, 2010/08/16
[PATCH 4/5] Implement /proc/cmdline as a symlinks to 2/cmdline, Jeremie Koenig, 2010/08/16
[PATCH 3/5] Set an appropriate st_mode on symlinks, Jeremie Koenig, 2010/08/16
[PATCH 2/5] update_pid_entries(): fix awkwardly indented uninitialized memory leak,
Jeremie Koenig <=
[PATCH 5/5] Implement /proc/mounts as a symlink to /etc/mtab, Jeremie Koenig, 2010/08/16