diff options
-rw-r--r-- | src/crash-manager/so-info.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/crash-manager/so-info.c b/src/crash-manager/so-info.c index 5dc26ff..d2526d7 100644 --- a/src/crash-manager/so-info.c +++ b/src/crash-manager/so-info.c @@ -215,6 +215,19 @@ static char *get_exe_filename(char *line) return NULL; } +bool list_contains_string(GSList *list, const char *string, const size_t max_len) +{ + if (list == NULL || string == NULL) + return false; + + for (GSList *iterator = list; iterator; iterator = iterator->next) { + if (strncmp((char*)iterator->data, string, max_len) == 0) + return true; + } + + return false; +} + GSList *get_filepaths(char *map_path) { char *line = NULL; @@ -242,7 +255,10 @@ GSList *get_filepaths(char *map_path) snprintf(file_name, n+1, "%s", exe_filename); - file_list = g_slist_append(file_list, file_name); + if (!list_contains_string(file_list, file_name, PATH_MAX)) + file_list = g_slist_append(file_list, file_name); + else + free(file_name); } } |