aboutsummaryrefslogtreecommitdiffstats
path: root/sgsnemu
diff options
context:
space:
mode:
authorjjako <jjako>2003-10-25 15:59:31 +0000
committerjjako <jjako>2003-10-25 15:59:31 +0000
commit0b076a331e1e7f955580313a5da416c170b3b4ce (patch)
treec92324bb535a9bd1a61112a44189cfa7b4bc1d75 /sgsnemu
parentccc564f878ded6001be9d6c477037274296b36c7 (diff)
Fixed sgsnemu freepdp on failed create context.
Diffstat (limited to 'sgsnemu')
-rw-r--r--sgsnemu/sgsnemu.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 9befbfb..e636f1b 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -791,6 +791,8 @@ int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) {
}
else {
state = 0;
+ pdp_freepdp(iph->pdp);
+ iph->pdp = NULL;
return EOF;
}
}
@@ -798,11 +800,15 @@ int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) {
if (cause != 128) {
printf("Received create PDP context response. Cause value: %d\n", cause);
state = 0;
+ pdp_freepdp(iph->pdp);
+ iph->pdp = NULL;
return EOF; /* Not what we expected */
}
if (pdp_euaton(&pdp->eua, &addr)) {
printf("Received create PDP context response. Cause value: %d\n", cause);
+ pdp_freepdp(iph->pdp);
+ iph->pdp = NULL;
state = 0;
return EOF; /* Not a valid IP address */
}
@@ -943,7 +949,9 @@ int main(int argc, char **argv)
printf("Setting up PDP context #%d\n", n);
iparr[n].inuse = 1; /* TODO */
- /* Allocated here. Cleaned up in gtp.c:*/
+ /* Allocated here. */
+ /* If create context failes we have to deallocate ourselves. */
+ /* Otherwise it is deallocated gy gtplib */
pdp_newpdp(&pdp, options.imsi, n, NULL);
pdp->peer = &iparr[n];