diff --git a/lib/gis/copy_dir.c b/lib/gis/copy_dir.c index 226e25a5a39..8babbc2e964 100644 --- a/lib/gis/copy_dir.c +++ b/lib/gis/copy_dir.c @@ -141,8 +141,10 @@ int G_recursive_copy(const char *src, const char *dst) sprintf(path, "%s/%s", src, dp->d_name); sprintf(path2, "%s/%s", dst, dp->d_name); - if (G_recursive_copy(path, path2) != 0) + if (G_recursive_copy(path, path2) != 0) { + closedir(dirp); return 1; + } } closedir(dirp);