发帖
问题描述:LR8.1版本在中文版windos2003 Server R2上运行
脚本使用mmdrv执行的时候,发现内存不断增长
查看脚本,发现申请的数组和变量没有释放,试图用free释放内存,但是报错:
Action.c(200): Error: C interpreter run time error: Action.c (200):Error -- memory violation : Exception ACCESS_VIOLATION received.
请高手帮忙看下,为什么无法释放内存
脚本如下:
Action()
{
charrecvAccount;
char errorMsg;
char tokenSender;//拼装Token
char tokenReceiver;
char senderSocket;
char receiverSocket;
char *Cbuffer;
int num,offset,resultlen;
int rNum;
unsigned long InviteprmLen;
char *InviteParam,*InviteAddr;
int i=0;
/****************************************************创建者登录*********************************************************************/
sprintf(senderSocket,"%s",lr_eval_string("socket{rcs_uid}"));
lr_output_message(senderSocket);
//lrs_create_socket(senderSocket,"TCP", "RemoteHost=10.137.207.140:5252",LrsLastArg);
srand(time(NULL));
rNum = rand()%3;
lr_output_message("the num is %d\n",rNum);
if(rNum==0)
{
lrs_create_socket(senderSocket,"TCP", "RemoteHost=172.10.11.13:5222",LrsLastArg);
}
else if (rNum==1)
{
lrs_create_socket(senderSocket,"TCP", "RemoteHost=172.10.11.13:5222",LrsLastArg);
}
else
{
lrs_create_socket(senderSocket,"TCP", "RemoteHost=172.10.11.13:5222",LrsLastArg);
}
//lr_output_message(lr_eval_string(SocketName));
//拼装Token
strcat(tokenSender,"pc:");
strcat(tokenSender,lr_eval_string("{account}"));
strcat(tokenSender,"@im.wo.com.cn:DEGdfxDK|1|1|37318840045913|Avg6EAzXOrTTHoZVgyYfyd7O6etz8aKj4VdVh8uQnRgtQSHgiAuRYyjfItYwZXhQe1s2prfyA0BED9ptMBU1EIXfnuMlDsEzxfl7JMjimOHfDAVxSew94ayaMhvOUOVgTB3GS5eYI0mJKEM7KiNLg6dEuCHWtlHhN2YDn6PJ1SI-");
lr_output_message(tokenSender);
lr_save_string(b64_encode_string(tokenSender),"base64str");
lrs_send(senderSocket, "bufStream", LrsLastArg);
lrs_set_recv_timeout(30,0);
lrs_receive(senderSocket, "streamResp", LrsLastArg);
lrs_send(senderSocket, lr_eval_string("bufAuth"), LrsLastArg);
lrs_set_recv_timeout(30,0);
lrs_receive(senderSocket, "authResp", LrsLastArg);
lrs_save_param(senderSocket, NULL, "param1", 1, 7);
if(strcmp(lr_eval_string("{param1}"),"success")==0)
{
lr_output_message("登录成功!");
}
else
{
lrs_save_param(senderSocket, NULL, "param2", 0, 6);
strcat(errorMsg,lr_eval_string("{account}"));
strcat(errorMsg,"@im.wo.com.cn:");
strcat(errorMsg,lr_eval_string("{param2}"));
lr_error_message(errorMsg);
lrs_close_socket(senderSocket);//登录不成功,关闭连接,直接结束
return;
}
lr_save_string(lr_eval_string("{account}"),"senderAccount");
lr_save_string(lr_eval_string("{Guest}"),"recvAccount");
//释放数组
free(senderAccount);
free(errorMsg);
页:
[1]