commit - 44e1226a2053c76971c5bb2b222acf720453f866
commit + 223f4ba8a53034e099a1596ecc1d8430ea61e8a4
blob - aed0ab8b6184bc0a8594af6b2dd77d8d856d88df
blob + 1197d7902e8a188ee3b31346586a09ae40a16f43
--- 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)