diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-23 07:45:41 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-23 07:45:41 -0800 |
| commit | cb5febaea9d877209cc84fce7fd758f958613115 (patch) | |
| tree | 618fe42437128aa6ee652b500ed84ee4c46b8b3a /src/core/dialer.c | |
| parent | 78fdadd45472767aaab77209da11d62ca5ce8dc9 (diff) | |
| download | nng-cb5febaea9d877209cc84fce7fd758f958613115.tar.gz nng-cb5febaea9d877209cc84fce7fd758f958613115.tar.bz2 nng-cb5febaea9d877209cc84fce7fd758f958613115.zip | |
dialer/listener: don't allocate before we have a transport
This permits removal of an extra bit of clean up.
Diffstat (limited to 'src/core/dialer.c')
| -rw-r--r-- | src/core/dialer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/dialer.c b/src/core/dialer.c index 3cd6620f..5e44cbff 100644 --- a/src/core/dialer.c +++ b/src/core/dialer.c @@ -216,14 +216,13 @@ nni_dialer_create(nni_dialer **dp, nni_sock *s, const char *url_str) nni_dialer *d; int rv; - if ((d = NNI_ALLOC_STRUCT(d)) == NULL) { - return (NNG_ENOMEM); - } if (((tran = nni_sp_tran_find(url_str)) == NULL) || (tran->tran_dialer == NULL)) { - NNI_FREE_STRUCT(d); return (NNG_ENOTSUP); } + if ((d = NNI_ALLOC_STRUCT(d)) == NULL) { + return (NNG_ENOMEM); + } if ((rv = nni_url_parse_inline(&d->d_url, url_str)) != 0) { nni_url_fini(&d->d_url); NNI_FREE_STRUCT(d); |
