[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
memory leak with cp
From: |
root |
Subject: |
memory leak with cp |
Date: |
Tue, 6 Jan 2004 14:39:42 +0800 |
ALL versions contain this bug.
in cp.c, take care of attr_list.
attr_list NOT be freed !
static int
make_path_private (const char *const_dirpath, int src_offset, int mode,
const char *verbose_fmt_string, struct dir_attr **attr_list,
int *new_dst, int (*xstat)())
{
..............
>> *attr_list = NULL;
..............
while ((slash = strchr (slash, '/')))
{
/* Add this directory to the list of directories whose modes need
fixing later. */
struct dir_attr *new =
>> (struct dir_attr *) xmalloc (sizeof (struct dir_attr));
>> new->slash_offset = slash - dirpath;
>> new->next = *attr_list;
>> *attr_list = new;
static int do_copy (int n_files, char **file, const char *target_directory,
struct cp_options *x)
{
............
if (dest_is_dir)
{
/* cp file1...filen edir
Copy the files `file1' through `filen'
to the existing directory `edir'. */
int i;
for (i = 0; i < n_files; i++)
{
char *dst_path;
int parent_exists = 1; /* True if dir_name (dst_path) exists. */
>> struct dir_attr *attr_list;
..................
parent_exists = !make_path_private (dst_path,
arg_in_concat - dst_path,
S_IRWXU,
(x->verbose
? "%s -> %s\n" : NULL),
>> &attr_list, &new_dst,
x->xstat);
....................
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- memory leak with cp,
root <=