> > - if (xmdpy->smapi->destroy) > > - xmdpy->smapi->destroy(xmdpy->smapi); > > - free(xmdpy->smapi); > > + if (xmdpy->smapi) > > + { > > + if (xmdpy->smapi->destroy) > > + xmdpy->smapi->destroy(xmdpy->smapi); > > + free(xmdpy->smapi); > > + } > > I don't know this code so I don't know if the patch is right, but just > pointing out this hunk could be written as a simple one-line change: > > - if (xmdpy->smapi->destroy) > + if (xmdpy->smapi && xmdpy->smapi->destroy) >
Combining the two would cause xmdpy->smapi to leak when the xmdpy->smapi->destroy callback is null. This way, destroy get's called when it's set but xmdpy->smapi always gets freed. - Chuck
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev