commit - d855ad4fcc82e94f9232218d35c19c5f88b5d243
commit + 72fd8fc46dbf82d2aef3596866e49047d68e761b
blob - 3659093bee84b25db368dbe3c0e93a76adf6ed2d
blob + 62a5c6397e3238e2deac79abfc06c76a3d586dcd
--- lib/repository_admin.c
+++ lib/repository_admin.c
if (fchmod(*packfd, GOT_DEFAULT_PACK_MODE) == -1)
err = got_error_from_errno2("fchmod", *tmpfile_path);
done:
+ free(path);
if (err) {
- close(*packfd);
+ if (*packfd != -1)
+ close(*packfd);
*packfd = -1;
free(*tmpfile_path);
*tmpfile_path = NULL;
free(theirs[i]);
free(theirs);
if (packfd != -1 && close(packfd) == -1 && err == NULL)
- err = got_error_from_errno2("close", packfile_path);
+ err = got_error_from_errno2("close",
+ packfile_path ? packfile_path : tmpfile_path);
if (delta_cache && fclose(delta_cache) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (tmpfile_path && unlink(tmpfile_path) == -1 && err == NULL)
if (traversed_ids)
got_object_idset_free(traversed_ids);
if (packfd != -1 && close(packfd) == -1 && err == NULL)
- err = got_error_from_errno2("close", packfile_path);
+ err = got_error_from_errno2("close",
+ packfile_path ? packfile_path : tmpfile_path);
if (delta_cache && fclose(delta_cache) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (tmpfile_path && unlink(tmpfile_path) == -1 && err == NULL)