(fix): fuite de mémoire
This commit is contained in:
		
							parent
							
								
									3653e558f9
								
							
						
					
					
						commit
						64da29227e
					
				| @ -13,7 +13,7 @@ | |||||||
| int len(void** list) | int len(void** list) | ||||||
| { | { | ||||||
|   int index; |   int index; | ||||||
|   for (index = 0; list[index]!=NULL; index++); |    for (index = 0; list[index]!=NULL; index++); | ||||||
|   return index; |   return index; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -71,7 +71,7 @@ char* get_executable_path(const char* executable, lst** env) | |||||||
|       tab_free((void**)path_env_splited); |       tab_free((void**)path_env_splited); | ||||||
|       return path_file; |       return path_file; | ||||||
|     } |     } | ||||||
|        |      | ||||||
|     free(path_file); |     free(path_file); | ||||||
|   } |   } | ||||||
|   tab_free((void**)path_env_splited); |   tab_free((void**)path_env_splited); | ||||||
|  | |||||||
| @ -32,11 +32,13 @@ static char* get_prompt(lst** env) | |||||||
| 		strcpy(cwd, "~"); | 		strcpy(cwd, "~"); | ||||||
| 		strcat(cwd, cwd + strlen(home)); | 		strcat(cwd, cwd + strlen(home)); | ||||||
| 	}   | 	}   | ||||||
|   out = str_merger(8, "[", user, "@", hostname_buff, "]", " > ", cwd, " "); |   out = str_merger(8, user, "[", "@", hostname_buff, "]", " > ", cwd, " "); | ||||||
|  |   char* temp = out; | ||||||
|   if (strcmp(user, "root") == 0) |   if (strcmp(user, "root") == 0) | ||||||
|     out = str_merger(2, out, "# "); |     out = str_merger(2, "# ", out); | ||||||
|   else |   else | ||||||
|     out = str_merger(2, out, "$ "); |     out = str_merger(2,  "$ ", out); | ||||||
|  |   free(temp); | ||||||
|   return out; |   return out; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 guamss
						guamss