* path.cc (path_conv::check): Free wide_path and normalized_path if
necessary. * path.h (path_conv::path_conv): Set wide_path, normalized_path and normalized_path_size to 0 in all constructors.
This commit is contained in:
parent
78ee2ae11f
commit
c211f8eb24
|
@ -1,3 +1,10 @@
|
||||||
|
2008-05-20 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* path.cc (path_conv::check): Free wide_path and normalized_path if
|
||||||
|
necessary.
|
||||||
|
* path.h (path_conv::path_conv): Set wide_path, normalized_path and
|
||||||
|
normalized_path_size to 0 in all constructors.
|
||||||
|
|
||||||
2008-05-19 Corinna Vinschen <corinna@vinschen.de>
|
2008-05-19 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* syscalls.cc (rename): Allocate temporary path buffers using
|
* syscalls.cc (rename): Allocate temporary path buffers using
|
||||||
|
|
|
@ -812,10 +812,14 @@ path_conv::check (const char *src, unsigned opt,
|
||||||
path_flags = 0;
|
path_flags = 0;
|
||||||
known_suffix = NULL;
|
known_suffix = NULL;
|
||||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||||
|
if (wide_path)
|
||||||
|
cfree (wide_path);
|
||||||
wide_path = NULL;
|
wide_path = NULL;
|
||||||
case_clash = false;
|
case_clash = false;
|
||||||
memset (&dev, 0, sizeof (dev));
|
memset (&dev, 0, sizeof (dev));
|
||||||
fs.clear ();
|
fs.clear ();
|
||||||
|
if (!normalized_path_size && normalized_path)
|
||||||
|
cfree (normalized_path);
|
||||||
normalized_path = NULL;
|
normalized_path = NULL;
|
||||||
int component = 0; // Number of translated components
|
int component = 0; // Number of translated components
|
||||||
|
|
||||||
|
|
|
@ -206,35 +206,42 @@ class path_conv
|
||||||
void check (const char *src, unsigned opt = PC_SYM_FOLLOW,
|
void check (const char *src, unsigned opt = PC_SYM_FOLLOW,
|
||||||
const suffix_info *suffixes = NULL) __attribute__ ((regparm(3)));
|
const suffix_info *suffixes = NULL) __attribute__ ((regparm(3)));
|
||||||
|
|
||||||
path_conv (const device& in_dev): fileattr (INVALID_FILE_ATTRIBUTES),
|
path_conv (const device& in_dev)
|
||||||
wide_path (NULL), path_flags (0), known_suffix (NULL), error (0),
|
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path_flags (0),
|
||||||
dev (in_dev)
|
known_suffix (NULL), error (0), dev (in_dev), normalized_path (NULL),
|
||||||
|
normalized_path_size (0)
|
||||||
{
|
{
|
||||||
strcpy (path, in_dev.native);
|
strcpy (path, in_dev.native);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_conv (int, const char *src, unsigned opt = PC_SYM_FOLLOW,
|
path_conv (int, const char *src, unsigned opt = PC_SYM_FOLLOW,
|
||||||
const suffix_info *suffixes = NULL)
|
const suffix_info *suffixes = NULL)
|
||||||
|
: wide_path (NULL), normalized_path (NULL), normalized_path_size (0)
|
||||||
{
|
{
|
||||||
check (src, opt, suffixes);
|
check (src, opt, suffixes);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_conv (const UNICODE_STRING *src, unsigned opt = PC_SYM_FOLLOW,
|
path_conv (const UNICODE_STRING *src, unsigned opt = PC_SYM_FOLLOW,
|
||||||
const suffix_info *suffixes = NULL)
|
const suffix_info *suffixes = NULL)
|
||||||
|
: wide_path (NULL), normalized_path (NULL), normalized_path_size (0)
|
||||||
{
|
{
|
||||||
check (src, opt | PC_NULLEMPTY, suffixes);
|
check (src, opt | PC_NULLEMPTY, suffixes);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_conv (const char *src, unsigned opt = PC_SYM_FOLLOW,
|
path_conv (const char *src, unsigned opt = PC_SYM_FOLLOW,
|
||||||
const suffix_info *suffixes = NULL)
|
const suffix_info *suffixes = NULL)
|
||||||
|
: wide_path (NULL), normalized_path (NULL), normalized_path_size (0)
|
||||||
{
|
{
|
||||||
check (src, opt | PC_NULLEMPTY, suffixes);
|
check (src, opt | PC_NULLEMPTY, suffixes);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_conv (): fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL),
|
path_conv ()
|
||||||
path_flags (0), known_suffix (NULL), error (0),
|
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path_flags (0),
|
||||||
normalized_path (NULL)
|
known_suffix (NULL), error (0), normalized_path (NULL),
|
||||||
{path[0] = '\0';}
|
normalized_path_size (0)
|
||||||
|
{
|
||||||
|
path[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
~path_conv ();
|
~path_conv ();
|
||||||
inline char *get_win32 () { return path; }
|
inline char *get_win32 () { return path; }
|
||||||
|
|
Loading…
Reference in New Issue