extensions: split assignments and if-exprs

This commit is contained in:
Jan Engelhardt
2020-10-25 15:41:24 +01:00
parent 939d3ee0d3
commit bfb0516c79
8 changed files with 22 additions and 15 deletions

View File

@@ -34,7 +34,8 @@ int ipt_ACCOUNT_init(struct ipt_ACCOUNT_context *ctx)
// 4096 bytes default buffer should save us from reallocations
// as it fits 200 concurrent active clients
if ((ctx->data = malloc(IPT_ACCOUNT_MIN_BUFSIZE)) == NULL) {
ctx->data = malloc(IPT_ACCOUNT_MIN_BUFSIZE);
if (ctx->data == NULL) {
close(ctx->sockfd);
ctx->sockfd = -1;
ctx->error_str = "Out of memory for data buffer";

View File

@@ -627,7 +627,8 @@ static int ipt_acc_handle_prepare_read(struct ipt_acc_table *ipt_acc_tables,
dest->itemcount = ipt_acc_tables[table_nr].itemcount;
/* allocate "root" table */
if ((dest->data = ipt_acc_zalloc_page()) == NULL) {
dest->data = ipt_acc_zalloc_page();
if (dest->data == NULL) {
printk("ACCOUNT: out of memory for root table "
"in ipt_acc_handle_prepare_read()\n");
return -1;
@@ -725,7 +726,8 @@ static int ipt_acc_handle_prepare_read_flush(struct ipt_acc_table *ipt_acc_table
}
/* Try to allocate memory */
if (!(new_data_page = ipt_acc_zalloc_page())) {
new_data_page = ipt_acc_zalloc_page();
if (new_data_page == NULL) {
printk("ACCOUNT: ipt_acc_handle_prepare_read_flush(): "
"Out of memory!\n");
return -1;
@@ -979,7 +981,8 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len)
/* Allocate a userspace handle */
down(&ian->ipt_acc_userspace_mutex);
if ((handle.handle_nr = ipt_acc_handle_find_slot(ian->ipt_acc_handles)) == -1) {
handle.handle_nr = ipt_acc_handle_find_slot(ian->ipt_acc_handles);
if (handle.handle_nr == -1) {
ipt_acc_data_free(dest.data, dest.depth);
up(&ian->ipt_acc_userspace_mutex);
return -EINVAL;