Fixing resource leak in libCDG