summaryrefslogtreecommitdiff
path: root/Src/Modules
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-29 21:05:17 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-29 21:05:17 +0000
commitbc8491c3dc939411546d0b5ee5fe25551bce424f (patch)
tree9ce77362bb55f9c83317233a0a0b14363908c32e /Src/Modules
parent22ad56296d9f2c2f57c1e6d38ad3f4b94afc9a41 (diff)
downloadzsh-bc8491c3dc939411546d0b5ee5fe25551bce424f.tar.gz
zsh-bc8491c3dc939411546d0b5ee5fe25551bce424f.zip
34430: parameter fixes for gdbm tied hash.
Probably fix the issue with correct parameter hiding or not hiding. A little extra safety checking. Possibly fixed a memory leak with untying.
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/db_gdbm.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index d75af980b..a6027deaf 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -105,7 +105,6 @@ static int
bin_zuntie(char *nam, char **args, Options ops, UNUSED(int func))
{
Param pm;
- GDBM_FILE dbf;
char *pmname;
int ret = 0;
@@ -116,12 +115,18 @@ bin_zuntie(char *nam, char **args, Options ops, UNUSED(int func))
ret = 1;
continue;
}
+ if (pm->gsu.h != &gdbm_hash_gsu) {
+ zwarnnam(nam, "not a tied gdbm hash: %s", pmname);
+ ret = 1;
+ continue;
+ }
- dbf = (GDBM_FILE)(pm->u.hash->tmpdata);
- gdbm_close(dbf);
- /* free(pm->u.hash->tmpdata); */
- pm->u.hash->tmpdata = NULL;
- paramtab->removenode(paramtab, pm->node.nam);
+ queue_signals();
+ if (unsetparam_pm(pm, 0, 1)) {
+ /* assume already reported */
+ ret = 1;
+ }
+ unqueue_signals();
}
return ret;