source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: This code wasted memory by allocating sizeof(enum termfont *)
@ 2016-01-07 21:04 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-01-07 21:04 UTC (permalink / raw)
  To: source

Log Message:
-----------
This code wasted memory by allocating sizeof(enum termfont *)
where only sizeof(enum termfont) is needed.
Fixes CID 1288941.  From christos@ via wiz@, both at NetBSD.

Modified Files:
--------------
    mdocml:
        term.c

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term.c,v
retrieving revision 1.255
retrieving revision 1.256
diff -Lterm.c -Lterm.c -u -p -r1.255 -r1.256
--- term.c
+++ term.c
@@ -365,7 +365,7 @@ term_fontpush(struct termp *p, enum term
 	if (++p->fonti == p->fontsz) {
 		p->fontsz += 8;
 		p->fontq = mandoc_reallocarray(p->fontq,
-		    p->fontsz, sizeof(enum termfont *));
+		    p->fontsz, sizeof(*p->fontq));
 	}
 	p->fontq[p->fonti] = f;
 }
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2016-01-07 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 21:04 mdocml: This code wasted memory by allocating sizeof(enum termfont *) schwarze

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).