core: fix potential memory leak with infolists not freed in plugins (debian #751108)

The memory leak should not happen if infolists are properly freed by plugins,
and it happened only on unload of plugins (or exit).