Unverified Commit 05c24c44 by Edward Thomson Committed by GitHub

Merge pull request #4527 from pks-t/pks/resource-leaks

Plug resource leaks
parents 028a2806 178fda8a
...@@ -57,7 +57,7 @@ GIT_INLINE(int) hash_cng_prov_init(void) ...@@ -57,7 +57,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
if (hash_prov.prov.cng.open_algorithm_provider(&hash_prov.prov.cng.handle, GIT_HASH_CNG_HASH_TYPE, NULL, GIT_HASH_CNG_HASH_REUSABLE) < 0) { if (hash_prov.prov.cng.open_algorithm_provider(&hash_prov.prov.cng.handle, GIT_HASH_CNG_HASH_TYPE, NULL, GIT_HASH_CNG_HASH_REUSABLE) < 0) {
FreeLibrary(hash_prov.prov.cng.dll); FreeLibrary(hash_prov.prov.cng.dll);
giterr_set(GITERR_OS "algorithm provider could not be initialized"); giterr_set(GITERR_OS, "algorithm provider could not be initialized");
return -1; return -1;
} }
......
...@@ -1373,6 +1373,8 @@ int git_odb_open_wstream( ...@@ -1373,6 +1373,8 @@ int git_odb_open_wstream(
(*stream)->received_bytes = 0; (*stream)->received_bytes = 0;
done: done:
if (error)
git__free(ctx);
return error; return error;
} }
......
...@@ -433,7 +433,8 @@ static int read_header_loose(git_rawobj *out, git_buf *loc) ...@@ -433,7 +433,8 @@ static int read_header_loose(git_rawobj *out, git_buf *loc)
} }
done: done:
p_close(fd); if (fd >= 0)
p_close(fd);
return error; return error;
} }
...@@ -1030,6 +1031,7 @@ done: ...@@ -1030,6 +1031,7 @@ done:
git_futils_mmap_free(&stream->map); git_futils_mmap_free(&stream->map);
git_zstream_free(&stream->zstream); git_zstream_free(&stream->zstream);
git_hash_ctx_cleanup(hash_ctx); git_hash_ctx_cleanup(hash_ctx);
git__free(hash_ctx);
git__free(stream); git__free(stream);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment