32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
From 64d2de103781595d8025acc60b851103e6f113a0 Mon Sep 17 00:00:00 2001
|
|
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
Date: Mon, 2 Mar 2015 14:09:29 +0300
|
|
Subject: [PATCH 12/23] convert(): plug potential memory leak
|
|
|
|
When the result of conversion is identical to the original argument, we
|
|
should make sure that the temporary buffer was released.
|
|
|
|
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
---
|
|
winsup/cygwin/path.cc | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
|
|
index f6bb210ce..e71db51b2 100644
|
|
--- a/winsup/cygwin/path.cc
|
|
+++ b/winsup/cygwin/path.cc
|
|
@@ -3523,6 +3523,10 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions,
|
|
// Don't allocate memory if no conversion happened.
|
|
if (!strcmp (arg, stack_path))
|
|
{
|
|
+ if (arg != stack_path)
|
|
+ {
|
|
+ free (stack_path);
|
|
+ }
|
|
return ((char *)arg);
|
|
}
|
|
arg_result = (char *)realloc (stack_path, strlen (stack_path)+1);
|
|
--
|
|
2.14.1
|
|
|