Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[irods#7540] Fix double-free in rsCollRepl
rsCloseCollection already frees the struct that collEnt's members are assigned to. They are pointer-assigned in getNextCollMetaInfo/getNextDataObjMetaInfo, so they point to the same allocated memory. The reason this works normally is because the end of the while loop NULLs out collEnt, so freeCollEnt does nothing. When erroring, it doesn't happen, so freeCollEnt goes into clearCollEnt, which double-frees. Regular free is still needed in error cases, because collEnt itself won't be freed. Regular free will not fail in normal cases, because free(NULL) does nothing.
- Loading branch information