zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: minor stuff
@ 1999-06-24 16:11 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-06-24 16:11 UTC (permalink / raw)
  To: Zsh hackers list

I noticed that dyncat() was advertised as always using heap memory, whereas
actually it uses ncalloc() which chooses the current sort of allocation.
Since all the uses seem to be in places where the memory doesn't get
explicitly freed, maybe we should change the code to match the comment
(which I probably put there).

While I was doing this I noticed that the hashtable element tablename was
never freed.  It's only used with --zsh-hash-debug.

--- Src/glob.c.dc	Mon Jun 14 09:22:10 1999
+++ Src/glob.c	Thu Jun 24 18:04:31 1999
@@ -1993,7 +1993,7 @@
     char *ptr;
     int l1 = strlen(s1);
 
-    ptr = (char *)ncalloc(l1 + strlen(s2) + 1);
+    ptr = (char *)zhalloc(l1 + strlen(s2) + 1);
     strcpy(ptr, s1);
     strcpy(ptr + l1, s2);
     return ptr;
--- Src/hashtable.c.dc	Fri Jun 18 13:49:29 1999
+++ Src/hashtable.c	Thu Jun 24 17:57:56 1999
@@ -133,6 +133,7 @@
 	ht->last->next = ht->next;
     else
 	firstht = ht->next;
+    zsfree(ht->tablename);
 #endif /* ZSH_HASH_DEBUG */
     zfree(ht->nodes, ht->hsize * sizeof(HashNode));
     zfree(ht, sizeof(*ht));

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-06-24 16:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-24 16:11 PATCH: minor stuff Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).