free some memory

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7721 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2000-01-05 13:48:58 +00:00
parent 37491685e5
commit e2e63ad12b

View File

@@ -50,6 +50,19 @@ struct fileinfo {
char *link;
};
static void
free_fileinfo(struct fileinfo *f)
{
free(f->user);
free(f->group);
free(f->size);
free(f->major);
free(f->minor);
free(f->date);
free(f->filename);
free(f->link);
}
#define LS_DIRS 1
#define LS_IGNORE_DOT 2
#define LS_SORT_MODE 12
@@ -362,7 +375,7 @@ lstat_file (const char *file, struct stat *sb)
}
static void
list_files(FILE *out, char **files, int n_files, int flags)
list_files(FILE *out, const char **files, int n_files, int flags)
{
struct fileinfo *fi;
int i;
@@ -468,6 +481,9 @@ list_files(FILE *out, char **files, int n_files, int flags)
max_major,
max_minor,
max_date);
for(i = 0; i < n_files; i++)
free_fileinfo(&fi[i]);
free(fi);
}
}
@@ -522,7 +538,7 @@ list_dir(FILE *out, const char *directory, int flags)
++n_files;
}
closedir(d);
list_files(out, files, n_files, flags | LS_DIRS);
list_files(out, (const char**)files, n_files, flags | LS_DIRS);
}
void