mirror of
https://gitlab.com/klmp200/fish.git
synced 2024-11-21 16:23:20 +00:00
Plus de fuites de mémoire
This commit is contained in:
parent
5cef74481c
commit
a826969c3e
@ -42,7 +42,7 @@ int fishHelp(WordArray *args) {
|
||||
int i;
|
||||
printf("Bartuccio Antoine, Amalvy Arthur, Yann Chevanton\n");
|
||||
printf("Tape tes putains de noms de programmes et tes arguments de merde et tabasse ENTER !\n");
|
||||
printf("Les commandes suivantes sont internes :\nls");
|
||||
printf("Les commandes suivantes sont internes :\n");
|
||||
for (i=0; i < getNbBuiltins(); i++){
|
||||
printf("\t%s\n", builtinCommandsStr[i]);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ WordArray * split(char *string, char *separator){
|
||||
int array_size = countSeparators(string, separator) + 1;
|
||||
WordArray *tokens = (WordArray*) malloc(sizeof(WordArray));
|
||||
char *to_delete = strdup(string);
|
||||
char *to_delete_bak = to_delete;
|
||||
char *token = NULL;
|
||||
int i = 0;
|
||||
|
||||
@ -70,7 +71,7 @@ WordArray * split(char *string, char *separator){
|
||||
i++;
|
||||
}
|
||||
|
||||
free(to_delete);
|
||||
free(to_delete_bak);
|
||||
|
||||
return tokens;
|
||||
}
|
||||
@ -81,6 +82,7 @@ void freeWordArray(WordArray *array) {
|
||||
for (i = 0; i < array->size; i++) {
|
||||
free(array->words[i]);
|
||||
}
|
||||
free(array->words);
|
||||
free(array);
|
||||
}
|
||||
|
||||
@ -141,6 +143,13 @@ Settings *getSettings() {
|
||||
return s;
|
||||
}
|
||||
|
||||
void freeSettings(Settings *settings){
|
||||
if (settings != NULL){
|
||||
free(settings->PS1);
|
||||
free(settings);
|
||||
}
|
||||
}
|
||||
|
||||
int fishLoad(WordArray *array) {
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
@ -17,6 +17,7 @@ void freeWordArray(WordArray *array);
|
||||
/* Settings functions */
|
||||
|
||||
Settings * getSettings();
|
||||
void freeSettings(Settings *settings);
|
||||
|
||||
|
||||
/* General purpose functions */
|
||||
|
Loading…
Reference in New Issue
Block a user