Browse Source

Fix newly added memory leak

Serj Kalichev 9 years ago
parent
commit
dab6466138
2 changed files with 4 additions and 2 deletions
  1. 0 1
      clish/shell/shell_startup.c
  2. 4 1
      clish/view/view.c

+ 0 - 1
clish/shell/shell_startup.c

@@ -83,7 +83,6 @@ const char * clish_shell__get_default_shebang(const clish_shell_t *this)
 /* Don't forget:
  *    Global view
  *    hooks
- *    remove unresolved syms list
  */
 
 int clish_shell_prepare(clish_shell_t *this)

+ 4 - 1
clish/view/view.c

@@ -69,6 +69,7 @@ static void clish_view_fini(clish_view_t * this)
 {
 	clish_command_t *cmd;
 	lub_list_node_t *iter;
+	clish_nspace_t *nspace;
 
 	/* delete each command held by this view */
 	while ((cmd = lub_bintree_findfirst(&this->tree))) {
@@ -82,8 +83,10 @@ static void clish_view_fini(clish_view_t * this)
 	while ((iter = lub_list__get_head(this->nspaces))) {
 		/* Remove the nspace from the list */
 		lub_list_del(this->nspaces, iter);
+		nspace = (clish_nspace_t *)lub_list_node__get_data(iter);
+		lub_list_node_free(iter);
 		/* Free the instance */
-		clish_nspace_delete((clish_nspace_t *)lub_list_node__get_data(iter));
+		clish_nspace_delete(nspace);
 	}
 	lub_list_free(this->nspaces);