mirror of
https://gitlab.com/klmp200/fish.git
synced 2024-11-13 04:13:19 +00:00
En route vers le 0 leak memory
This commit is contained in:
parent
774161d7ff
commit
34b8cbe3cf
@ -44,8 +44,10 @@ include_directories(
|
||||
"${source_dir}/googlemock/include"
|
||||
)
|
||||
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_FLAGS "-Wall -Werror -pedantic -fpic -Wextra -Wshadow")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FALGS} -g")
|
||||
|
||||
set(SOURCE_FILES fish_shell/main.c fish_shell/fish_types.h fish_shell/fish_core.h fish_shell/fish_core.c fish_shell/fish_commands.c fish_shell/fish_commands.h fish_shell/fish_globbing.c fish_shell/fish_globbing.h fish_shell/fish_utils.c fish_shell/fish_utils.h)
|
||||
add_executable(fish ${SOURCE_FILES})
|
||||
|
@ -110,12 +110,11 @@ WordArray *wordListToWordArray(WordList *list) {
|
||||
if (array->words == NULL) crash();
|
||||
|
||||
while (current != NULL){
|
||||
array->words[i] = current->word;
|
||||
current->word = NULL;
|
||||
array->words[i] = strdup(current->word);
|
||||
current = current->next;
|
||||
i++;
|
||||
}
|
||||
array->words[i] = NULL;
|
||||
array->words[array->size] = NULL;
|
||||
}
|
||||
|
||||
freeWordList(list);
|
||||
@ -125,7 +124,7 @@ WordArray *wordListToWordArray(WordList *list) {
|
||||
|
||||
WordList *wordArrayToWordList(WordArray *array) {
|
||||
WordList *list = createWordList();
|
||||
int i = 0;
|
||||
int i;
|
||||
|
||||
for (i=0; i<array->size; i++)
|
||||
addWordList(list, array->words[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user