summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author李仁杰 <[email protected]>2020-08-03 16:21:02 +0800
committer李仁杰 <[email protected]>2020-08-03 16:21:02 +0800
commit72dcadb53e40bf50f54f8f9262bc791696eeffd1 (patch)
tree9983407ec7ca49df50919ac0226ddc05bf412054
parentda82e8273e2c8b84675e41dc57437af0ac704635 (diff)
Update lirenjie_vxlan_sapp_20200803.c 修复了内存bug
-rw-r--r--lirenjie_vxlan_sapp_20200803.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/lirenjie_vxlan_sapp_20200803.c b/lirenjie_vxlan_sapp_20200803.c
index ce26c2d..77c648e 100644
--- a/lirenjie_vxlan_sapp_20200803.c
+++ b/lirenjie_vxlan_sapp_20200803.c
@@ -701,7 +701,7 @@ char TCP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi
if (pstream->opstate == OP_STATE_PENDING)
{
- pme = (void **)calloc(3, sizeof(void *));
+ *pme = (void *)calloc(3, sizeof(void *));
time_old = (time_t *)calloc(1, sizeof(time_t));
tinfo_new = (struct traffic_info *)calloc(1, sizeof(struct traffic_info));
@@ -743,14 +743,14 @@ char TCP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi
*tinfo_new = *tinfo;
- pme[0] = tinfo;
- pme[1] = tinfo_new;
+ ((void **)*pme)[0] = tinfo;
+ ((void **)*pme)[1] = tinfo_new;
time(time_old);
- pme[2] = time_old;
+ ((void **)*pme)[2] = time_old;
}
- tinfo = (struct traffic_info *)(pme[0]);
- tinfo_new = (struct traffic_info *)(pme[1]);
- time_old = (time_t *)(pme[2]);
+ tinfo = (struct traffic_info *)(((void **)*pme)[0]);
+ tinfo_new = (struct traffic_info *)(((void **)*pme)[1]);
+ time_old = (time_t *)(((void **)*pme)[2]);
/* 自己统计包数字节数*/ /*
if(raw_pdetail->datalen > 0)
{
@@ -817,7 +817,7 @@ char TCP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi
free(tinfo);
free(tinfo_new);
free(time_old);
- free(pme);
+ free(*pme);
// printf("\n");
return DEFAULT_RETURN_VALUE;
}
@@ -875,7 +875,7 @@ error_drop:
free(tinfo);
free(tinfo_new);
free(time_old);
- free(pme);
+ free(*pme);
return APP_STATE_DROPME | APP_STATE_DROPPKT;
}
@@ -933,7 +933,7 @@ char UDP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi
if (pstream->opstate == OP_STATE_PENDING)
{
- pme = (void **)calloc(3, sizeof(void *));
+ *pme = (void *)calloc(3, sizeof(void *));
time_old = (time_t *)calloc(1, sizeof(time_t));
tinfo_new = (struct traffic_info *)calloc(1, sizeof(struct traffic_info));
@@ -976,14 +976,14 @@ char UDP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi
*tinfo_new = *tinfo;
- pme[0] = tinfo;
- pme[1] = tinfo_new;
+ ((void **)*pme)[0] = tinfo;
+ ((void **)*pme)[1] = tinfo_new;
time(time_old);
- pme[2] = time_old;
+ ((void **)*pme)[2] = time_old;
}
- tinfo = (struct traffic_info *)(pme[0]);
- tinfo_new = (struct traffic_info *)(pme[1]);
- time_old = (time_t *)(pme[2]);
+ tinfo = (struct traffic_info *)(((void **)*pme)[0]);
+ tinfo_new = (struct traffic_info *)(((void **)*pme)[1]);
+ time_old = (time_t *)(((void **)*pme)[2]);
/* if (pstream->opstate == OP_STATE_CLOSE && tinfo->vxlan_vpn_id > 0) */
// if (pstream->opstate == OP_STATE_CLOSE && !vpn_id_drop[tinfo->vxlan_vpn_id])
@@ -1045,7 +1045,7 @@ char UDP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi
free(tinfo);
free(tinfo_new);
free(time_old);
- free(pme);
+ free(*pme);
// printf("\n");
return DEFAULT_RETURN_VALUE;
}
@@ -1102,7 +1102,7 @@ error_drop:
free(tinfo);
free(tinfo_new);
free(time_old);
- free(pme);
+ free(*pme);
return APP_STATE_DROPME | APP_STATE_DROPPKT;
}