From 5af264a64282689453f79ce943604d20110e4ffd Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 29 May 2007 21:39:31 +0000 Subject: unposted: clean up properly on failure to add autoloadable builtin --- Src/module.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Src/module.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 * -- cgit 1.4.1