[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FW1] memory leak in general use of the opsec dll




Hi everyone,
here the problem I face.
I need to open and close lea session a lot of times, but it seems, that the 
opsec dll has some little memory problem, and I can't stop the memory 
increase, here is the simple code I use for a test, if anybody has anything 
about this, please tell me, it would be grateful.
By the way, this piece of code is being used in native mode from a Java 
application. so there are some restrictions ...
here is the code.
thanx in advance.
Remi.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include "opsec/lea.h"
#include "opsec/opsec.h"

int LeaStartHandler(OpsecSession *session)
{
//	printf("\n\n***** LEA Start_Handler was invoked *****\n\n");
	return OPSEC_SESSION_OK;
}

int LeaEndHandler(OpsecSession *session)
{
//	printf("\n\n***** LEA End_Handler was invoked *****\n\n");
	return OPSEC_SESSION_END;
}

int LeaRecordHandler(OpsecSession *session, lea_record *rec, int 
attrib_perm[])
{
	return OPSEC_SESSION_END;
}

int LeaDictionaryHandler(OpsecSession *session, int dict_id, LEA_VT 
val_type, int n_d_entries)
{
//	printf("\n***** New dictionary received. LeaDictionaryHandler invoked 
*****\n");

	return OPSEC_SESSION_OK;
}

int LeaEofHandler(OpsecSession *session)
{
//	printf("\n***** Finished reading current log-file *****\n");
	return OPSEC_SESSION_OK;
}

int LeaSwitchHandler(OpsecSession *session)
{
	return OPSEC_SESSION_OK;
}

int main(int ac, char *av[])
{
	static OpsecEntity	*client;
	static OpsecEntity	*server;
	OpsecSession		*session;
	OpsecEnv		*env;


	while (1)
	{
		if((env = opsec_init(OPSEC_CONF_FILE, "lea.conf", OPSEC_EOL)) == NULL)
		{
			printf("Unable to create environment\n");
			exit(1);
		}

		client = opsec_init_entity(env, LEA_CLIENT,
									OPSEC_SESSION_START_HANDLER, LeaStartHandler,
									LEA_RECORD_HANDLER, LeaRecordHandler,
									LEA_DICT_HANDLER, LeaDictionaryHandler,
									LEA_EOF_HANDLER, LeaEofHandler,
									LEA_SWITCH_HANDLER, LeaSwitchHandler,
									OPSEC_SESSION_END_HANDLER, LeaEndHandler,
									OPSEC_EOL);
		server = opsec_init_entity(env, LEA_SERVER, OPSEC_ENTITY_NAME, 
"lea_server", OPSEC_EOL);

		if (!(client || server))
		{
			fprintf(stderr,"failed to initialize client - server pair\n");
			exit(1);
		}

		if(!(session = lea_new_session(client, server, LEA_ONLINE, LEA_FILENAME, 
LEA_NORMAL, LEA_AT_START, 0)))
		{
			fprintf(stderr, "failed to start client to read fw.log\n");
			exit(1);
		}

		opsec_mainloop(env);

		opsec_destroy_entity(client);
		opsec_destroy_entity(server);

		opsec_env_destroy(env);
	}
	return 0;
}

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.



================================================================================
     To unsubscribe from this mailing list, please see the instructions at
               http://www.checkpoint.com/services/mailing.html
================================================================================