diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-06-22 01:36:25 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-06-22 01:36:25 +0200 |
commit | a4ffea95057c98e532c897bde6cc06a575dec2c3 (patch) | |
tree | e6c02cba13b93a542174f18a408075d6cdaa18ee /openbsc/src/input | |
parent | e441d9c36174037f50245a0dc47c4ec41b3b5421 (diff) |
fix various talloc / dynamic bts/trx related bugs
Prior to this patch, nanobts was not able to operate after recent changes
Diffstat (limited to 'openbsc/src/input')
-rw-r--r-- | openbsc/src/input/ipaccess.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/openbsc/src/input/ipaccess.c b/openbsc/src/input/ipaccess.c index c16bf1b60..b76629e5e 100644 --- a/openbsc/src/input/ipaccess.c +++ b/openbsc/src/input/ipaccess.c @@ -223,7 +223,7 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, memcpy(newbfd, bfd, sizeof(*newbfd)); bsc_unregister_fd(bfd); bsc_register_fd(newbfd); - free(bfd); + talloc_free(bfd); } break; case IPAC_MSGT_ID_ACK: @@ -454,7 +454,7 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) if (ret < 0) { fprintf(stderr, "could not register FD\n"); close(bfd->fd); - free(line); + talloc_free(line); return ret; } @@ -468,12 +468,17 @@ static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) { struct sockaddr_in sa; socklen_t sa_len = sizeof(sa); - struct bsc_fd *bfd = talloc(tall_bsc_ctx, struct bsc_fd); + struct bsc_fd *bfd; int ret; if (!(what & BSC_FD_READ)) return 0; + bfd = talloc(tall_bsc_ctx, struct bsc_fd); + if (!bfd) + return -ENOMEM; + memset(bfd, 0, sizeof(*bfd)); + /* Some BTS has connected to us, but we don't know yet which line * (as created by the OML link) to associate it with. Thus, we * aloocate a temporary bfd until we have received ID from BTS */ @@ -491,7 +496,7 @@ static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what) if (ret < 0) { fprintf(stderr, "could not register FD\n"); close(bfd->fd); - free(bfd); + talloc_free(bfd); return ret; } /* Request ID. FIXME: request LOCATION, HW/SW VErsion, Unit Name, Serno */ @@ -583,7 +588,10 @@ int ipaccess_setup(struct gsm_network *gsmnet) return ret; e1h = talloc(tall_bsc_ctx, struct ia_e1_handle); + if (!e1h) + return -ENOMEM; memset(e1h, 0, sizeof(*e1h)); + e1h->gsmnet = gsmnet; /* Listen for OML connections */ |