Merge pull request #4007 from libgit2/cmn/bump-v25
Bump version number to v0.25
diff --git a/src/curl_stream.c b/src/curl_stream.c
index 3a3f364..4e0455c 100644
--- a/src/curl_stream.c
+++ b/src/curl_stream.c
@@ -15,6 +15,16 @@
#include "vector.h"
#include "proxy.h"
+/* This is for backwards compatibility with curl<7.45.0. */
+#ifndef CURLINFO_ACTIVESOCKET
+# define CURLINFO_ACTIVESOCKET CURLINFO_LASTSOCKET
+# define GIT_CURL_BADSOCKET -1
+# define git_activesocket_t long
+#else
+# define GIT_CURL_BADSOCKET CURL_SOCKET_BAD
+# define git_activesocket_t curl_socket_t
+#endif
+
typedef struct {
git_stream parent;
CURL *handle;
@@ -87,7 +97,8 @@
static int curls_connect(git_stream *stream)
{
curl_stream *s = (curl_stream *) stream;
- long sockextr, connect_last = 0;
+ git_activesocket_t sockextr;
+ long connect_last = 0;
int failed_cert = 0, error;
bool retry_connect;
CURLcode res;
@@ -117,11 +128,11 @@
if (res == CURLE_PEER_FAILED_VERIFICATION)
failed_cert = 1;
- if ((res = curl_easy_getinfo(s->handle, CURLINFO_LASTSOCKET, &sockextr)) != CURLE_OK) {
+ if ((res = curl_easy_getinfo(s->handle, CURLINFO_ACTIVESOCKET, &sockextr)) != CURLE_OK) {
return seterr_curl(s);
}
- if (sockextr == -1) {
+ if (sockextr == GIT_CURL_BADSOCKET) {
giterr_set(GITERR_NET, "curl socket is no longer valid");
return -1;
}
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 7a4fe9f..f527594 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -1014,8 +1014,10 @@
return NULL;
if (content_len) {
- if ((ctx->content = git__malloc(content_len)) == NULL)
+ if ((ctx->content = git__malloc(content_len)) == NULL) {
+ git__free(ctx);
return NULL;
+ }
memcpy((char *)ctx->content, content, content_len);
}
diff --git a/src/sortedcache.c b/src/sortedcache.c
index ed4199b..5bd989a 100644
--- a/src/sortedcache.c
+++ b/src/sortedcache.c
@@ -216,6 +216,7 @@
if (p_fstat(fd, &st) < 0) {
giterr_set(GITERR_OS, "failed to stat file");
error = -1;
+ (void)p_close(fd);
goto unlock;
}