We don't support yet all the syscalls that can return a FD, so we should
at least make sure that we don't reuse closed filenames.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
if (tmp_file == NULL)
g_ptr_array_index(proc->process_files_table, fd) = file;
else {
- if (strcmp(tmp_file->name, file->name) != 0) {
+ if (!tmp_file->name ||
+ strcmp(tmp_file->name, file->name) != 0) {
size = proc->process_files_table->len;
g_ptr_array_set_size(proc->process_files_table,
size+1);
if (file != NULL) {
file->flag = __NR_close;
lttngtop.nbfiles--;
+ if (file->name) {
+ free(file->name);
+ file->name = NULL;
+ }
}
lttngtop.nbclosedfiles++;
}