about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-05-29 21:39:31 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-05-29 21:39:31 +0000
commit5af264a64282689453f79ce943604d20110e4ffd (patch)
tree1fdac98063eca4edc408aaca70507be7f1c7c2e4
parent6ab77f00ff8c4a30bf663f6e4ee39b9b23d3ef32 (diff)
downloadzsh-5af264a64282689453f79ce943604d20110e4ffd.tar.gz
zsh-5af264a64282689453f79ce943604d20110e4ffd.tar.xz
zsh-5af264a64282689453f79ce943604d20110e4ffd.zip
unposted: clean up properly on failure to add autoloadable builtin
-rw-r--r--ChangeLog5
-rw-r--r--Src/module.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c00076d4..b65cc2e6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-29  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* unposted: Src/module.c: failure adding autoload builtin
+	didn't clean up properly.
+
 2007-05-29  Peter Stephenson  <pws@csr.com>
 
 	* 23488: README, Etc/zsh-development-guide, Src/builtin.c,
diff --git a/Src/module.c b/Src/module.c
index c837193e8..05a0d402a 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -202,7 +202,11 @@ add_autobin(char *nam, char *module)
     Builtin bn = zshcalloc(sizeof(*bn));
     bn->node.nam = ztrdup(nam);
     bn->optstr = ztrdup(module);
-    return addbuiltin(bn);
+    if (addbuiltin(bn)) {
+	builtintab->freenode(&bn->node);
+	return 1;
+    }
+    return 0;
 }
 
 /* Remove the builtin added previously by addbuiltin().  Returns *