Fix local repository clone failure

avoid use object which is already free

Signed-off-by: Frank Li <lznuaa@gmail.com>