Fix some memory leaks when sdt or other modules with providers are
unloaded.