As Ned Flanders infamously said... Take out the crayolas and color me tickled
pink.
Here's the _actual_ patch.
Index: intercept.c
===================================================================
RCS file: /cvs/src/bin/systrace/intercept.c,v
retrieving revision 1.60
diff -u -p -u -r1.60 intercept.c
--- intercept.c 4 Dec 2012 02:24:47 -0000 1.60
+++ intercept.c 24 Apr 2014 01:42:57 -0000
@@ -426,10 +426,9 @@ intercept_getpid(pid_t pid)
if (tmp)
return (tmp);
- if ((tmp = malloc(sizeof(struct intercept_pid))) == NULL)
- err(1, "%s: malloc", __func__);
+ if ((tmp = calloc(1, sizeof(struct intercept_pid))) == NULL)
+ err(1, "%s: calloc", __func__);
- memset(tmp, 0, sizeof(struct intercept_pid));
tmp->pid = pid;
SPLAY_INSERT(pidtree, &pids, tmp);
On Wed, 23 Apr 2014 21:35:59 -0400
Ted Unangst <[email protected]> wrote:
> On Wed, Apr 23, 2014 at 21:24, Peter Malone wrote:
> > Hi,
> >
> > Similar to previous patches replacing malloc & memset with calloc, this
> > time in src/bin/systrace/intercept.c
> >
>
>
> > - tlnew = malloc(sizeof(struct intercept_translate));
> > + tlnew = calloc(1, sizeof(struct intercept_translate));
> > if (tlnew == NULL)
> > - err(1, "%s: %s-%s: malloc",
> > + err(1, "%s: %s-%s: calloc",
> > __func__, emulation, name);
> >
> > - memcpy(tlnew, tl, sizeof(struct intercept_translate));
>
> Ha, tricked you. :) That's a memcpy.
>
--
Peter Malone <[email protected]>