Mon Sep 19 07:15:50 EDT 2005 rsc
I edited this patch before applying it, to remove some of
the calls to setmalloctag. betomp illustrates the general
philosophy. It looks like this:
mpint*
betomp(int n)
{
b = malloc(sizeof *b);
b->p = malloc(n);
return b;
}
In this case, b should get tagged with setmalloctag,
because the responsibility for freeing (via mpfree)
b is being passed to the caller. b->p, on the other
hand, has a fine malloc tag as it is. The caller is
not responsible for freeing b->p. b->p is hidden from
the caller and expected to be freed by the innards of
mpfree.
|