Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Strickroth <email@cs-ware.de>2013-02-02 01:22:26 +0400
committerSven Strickroth <email@cs-ware.de>2013-02-02 03:52:23 +0400
commitbd25a302d3232dea375f226602fdcdb3a83abcdc (patch)
tree625d5f261a6d37629ab8cc255761ae2ad44f0be7 /src/netops.c
parent89ad1c57a351809d3173e22a26c84e7a16adbe6b (diff)
Improved error handling
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'src/netops.c')
-rw-r--r--src/netops.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/netops.c b/src/netops.c
index c5554ef86..86579c7f2 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -48,8 +48,16 @@ static void net_set_error(const char *str)
int utf8_size = WideCharToMultiByte(CP_UTF8, 0, err_str, -1, NULL, 0, NULL, NULL);
char * err_str_utf8 = git__malloc(utf8_size * sizeof(char));
- GITERR_CHECK_ALLOC(err_str_utf8);
- WideCharToMultiByte(CP_UTF8, 0, err_str, -1, err_str_utf8, utf8_size, NULL, NULL);
+ if (err_str_utf8 == NULL) {
+ LocalFree(err_str);
+ return;
+ }
+
+ if (!WideCharToMultiByte(CP_UTF8, 0, err_str, -1, err_str_utf8, utf8_size, NULL, NULL)) {
+ LocalFree(err_str);
+ git__free(err_str_utf8);
+ return;
+ }
giterr_set(GITERR_NET, "%s: %s", str, err_str_utf8);
LocalFree(err_str);