summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-04-20 14:32:29 +0000
committerChristopher Faylor <me@cgf.cx>2010-04-20 14:32:29 +0000
commit27f1db48c7be1d40b320705395f36b4e395f4af1 (patch)
treea69a38b766d49572f8d19a55206cde7096f5702e /winsup/cygwin/path.cc
parent9e40fe81120619ab9fb1f610d7c2a5062915dca4 (diff)
downloadcygnal-27f1db48c7be1d40b320705395f36b4e395f4af1.tar.gz
cygnal-27f1db48c7be1d40b320705395f36b4e395f4af1.tar.bz2
cygnal-27f1db48c7be1d40b320705395f36b4e395f4af1.zip
* path.cc (cygwin_create_path): Free memory on error.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 9e57a0f15..f8f65d624 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2812,11 +2812,14 @@ cygwin_create_path (cygwin_conv_path_t what, const void *from)
void *to;
ssize_t size = cygwin_conv_path (what, from, NULL, 0);
if (size <= 0)
- return NULL;
- if (!(to = malloc (size)))
- return NULL;
+ to = NULL;
+ else if (!(to = malloc (size)))
+ to = NULL;
if (cygwin_conv_path (what, from, to, size) == -1)
- return NULL;
+ {
+ free (to);
+ to = NULL;
+ }
return to;
}