Working version: still some mem-leaks on cases where share-files 1&4, 2&4, and 1&3 are present