aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2014-10-03 19:01:46 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2014-10-03 20:29:12 +0000
commita6988b451f88aa3a2d66d0f59f6a72180fea249c (patch)
tree221732a2499b01e8979a8242420034216b7adc4c /extcap.c
parent8b7d27c8be1418642fbf089dfdb295a2fc5e5211 (diff)
Fix memory leak and heap corruption on Windows.
LPSECURITY_ATTRIBUTES is type definition for pointer to SECURITY_ATTRIBUTES structure. Change-Id: I94a835bfd8f7eb76c808fac8286ca3f2db9b19c3 Reviewed-on: https://code.wireshark.org/review/4449 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/extcap.c b/extcap.c
index faded7bfa7..1622706ba0 100644
--- a/extcap.c
+++ b/extcap.c
@@ -520,17 +520,17 @@ gboolean extcap_create_pipe(char ** fifo)
gchar *pipename = NULL;
- LPSECURITY_ATTRIBUTES security = NULL;
+ SECURITY_ATTRIBUTES security;
/* create pipename */
current_time = time(NULL);
strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(&current_time));
pipename = g_strconcat ( "\\\\.\\pipe\\", EXTCAP_PIPE_PREFIX, "_", timestr, NULL );
/* Security struct to enable Inheritable HANDLE */
- security = (LPSECURITY_ATTRIBUTES)g_malloc0(sizeof(LPSECURITY_ATTRIBUTES));
- security->nLength = sizeof(LPSECURITY_ATTRIBUTES);
- security->bInheritHandle = TRUE;
- security->lpSecurityDescriptor = NULL;
+ memset(&security, 0, sizeof(SECURITY_ATTRIBUTES));
+ security.nLength = sizeof(SECURITY_ATTRIBUTES);
+ security.bInheritHandle = TRUE;
+ security.lpSecurityDescriptor = NULL;
/* create a namedPipe*/
pipe_h = CreateNamedPipe(
@@ -539,7 +539,7 @@ gboolean extcap_create_pipe(char ** fifo)
PIPE_TYPE_MESSAGE| PIPE_READMODE_MESSAGE | PIPE_WAIT,
5, 65536, 65536,
300,
- security);
+ &security);
if (pipe_h == INVALID_HANDLE_VALUE)
{