> > { > > #ifdef CONFIG_SMP > > kfree((void *)mm->context); > > #else > > /* Nothing to do. */ > > #endif > > } > > > > And when I tested this I do not see the memory leak any more. > > Almost correct, as James already explained you have to check for a > non-null pointer first. Hm. It was pointed out that kfree actually does the checking for us. Do we really need the check? > We got a more elegant implementation of > context switching which I'll add to CVS asap; it gets away without > any memory allocation. :-)