ns2: Memory allocation failures are ENOMEM, not ENOSPC

ENOSPC is used with non-volatile (disk) storage, while ENOMEM is
customarily used for RAM allocation failures.

Change-Id: Ia4c16d8278dc30c7cc69169b18428cda5272738d
This commit is contained in:
Harald Welte 2021-01-31 11:44:57 +01:00
parent c3aa8f903a
commit bdfb8b9104
4 changed files with 5 additions and 5 deletions

View File

@ -1367,12 +1367,12 @@ int ns2_bind_alloc(struct gprs_ns2_inst *nsi, const char *name,
bind = talloc_zero(nsi, struct gprs_ns2_vc_bind); bind = talloc_zero(nsi, struct gprs_ns2_vc_bind);
if (!bind) if (!bind)
return -ENOSPC; return -ENOMEM;
bind->name = talloc_strdup(bind, name); bind->name = talloc_strdup(bind, name);
if (!bind->name) { if (!bind->name) {
talloc_free(bind); talloc_free(bind);
return -ENOSPC; return -ENOMEM;
} }
bind->nsi = nsi; bind->nsi = nsi;

View File

@ -738,7 +738,7 @@ int gprs_ns2_fr_bind(struct gprs_ns2_inst *nsi,
bind->dump_vty = dump_vty; bind->dump_vty = dump_vty;
priv = bind->priv = talloc_zero(bind, struct priv_bind); priv = bind->priv = talloc_zero(bind, struct priv_bind);
if (!priv) { if (!priv) {
rc = -ENOSPC; rc = -ENOMEM;
goto err_bind; goto err_bind;
} }

View File

@ -565,7 +565,7 @@ int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
priv = bind->priv = talloc_zero(bind, struct priv_bind); priv = bind->priv = talloc_zero(bind, struct priv_bind);
if (!priv) { if (!priv) {
gprs_ns2_free_bind(bind); gprs_ns2_free_bind(bind);
return -ENOSPC; return -ENOMEM;
} }
priv->fd.cb = frgre_fd_cb; priv->fd.cb = frgre_fd_cb;
priv->fd.data = bind; priv->fd.data = bind;

View File

@ -341,7 +341,7 @@ int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi,
priv = bind->priv = talloc_zero(bind, struct priv_bind); priv = bind->priv = talloc_zero(bind, struct priv_bind);
if (!priv) { if (!priv) {
gprs_ns2_free_bind(bind); gprs_ns2_free_bind(bind);
return -ENOSPC; return -ENOMEM;
} }
priv->fd.cb = nsip_fd_cb; priv->fd.cb = nsip_fd_cb;
priv->fd.data = bind; priv->fd.data = bind;