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

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-05-20 15:00:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-05-20 15:00:37 +0400
commit3ccae7b681dfa1d1fc9cdeae8cbe74e82664563f (patch)
tree382c8136a1fa68a18649a4fa128eaf7bc3d05c5d /winsup
parent3da259f729948e75aacd972ac2200499b2311117 (diff)
* fhandler_proc.cc (format_proc_swaps): Use tmp_pathbuf for filename,
rather than allocating and forgetting to free (CID 59982).
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_proc.cc12
2 files changed, 8 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 5670bec98..b128aabfb 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2014-05-20 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler_proc.cc (format_proc_swaps): Use tmp_pathbuf for filename,
+ rather than allocating and forgetting to free (CID 59982).
+
+2014-05-20 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Fix floppy
drive handling broken with 1.7.19.
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index 45723718d..adb58560e 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -1,7 +1,7 @@
/* fhandler_proc.cc: fhandler for /proc virtual filesystem
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
- 2013 Red Hat, Inc.
+ 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@@ -1270,8 +1270,6 @@ static off_t
format_proc_swaps (void *, char *&destbuf)
{
unsigned long long total = 0ULL, used = 0ULL;
- char *filename = NULL;
- ssize_t filename_len;
PSYSTEM_PAGEFILE_INFORMATION spi = NULL;
ULONG size = 512;
NTSTATUS status = STATUS_SUCCESS;
@@ -1301,17 +1299,13 @@ format_proc_swaps (void *, char *&destbuf)
if (spi && NT_SUCCESS (status))
{
PSYSTEM_PAGEFILE_INFORMATION spp = spi;
+ char *filename = tp.c_get ();
do
{
total = (unsigned long long) spp->CurrentSize * wincap.page_size ();
used = (unsigned long long) spp->TotalUsed * wincap.page_size ();
-
- filename_len = cygwin_conv_path (CCP_WIN_W_TO_POSIX,
- spp->FileName.Buffer, filename, 0);
- filename = (char *) malloc (filename_len);
cygwin_conv_path (CCP_WIN_W_TO_POSIX, spp->FileName.Buffer,
- filename, filename_len);
-
+ filename, NT_MAX_PATH);
bufptr += sprintf (bufptr, "%-40s%-16s%-8llu%-8llu%-8d\n",
filename, "file", total >> 10, used >> 10, 0);
}