summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-02-20 14:53:27 +0100
committerThomas Haller <thaller@redhat.com>2019-02-21 21:00:44 +0100
commit8e11a50d01ff80668924338bc287a22006553cb8 (patch)
tree60cedadeaf485f685a0467bad905264373eb0162
parenta05f500de2556af0d15fe8b1206d9ff6f13994a2 (diff)
downloadNetworkManager-8e11a50d01ff80668924338bc287a22006553cb8.tar.gz
platform: fix error handling for creating nlmsg in do_request_all_no_delayed_actions()
In practice, we don't fail to create the nlmsg, because in glib malloc() cannot fail and we always create large enough buffers. Anyway, handle the error correctly, and reduce the in-progress counter again.
-rw-r--r--src/platform/nm-linux-platform.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 09f75a80cf..77a83791fa 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -5248,13 +5248,23 @@ do_request_all_no_delayed_actions (NMPlatform *platform, DelayedActionType actio
};
nle = nlmsg_append (nlmsg, &gmsg, sizeof (gmsg), NLMSG_ALIGNTO);
}
+
if (nle < 0)
- continue;
+ goto next_after_fail;
- if (_nl_send_nlmsg (platform, nlmsg, NULL, NULL, DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS, out_refresh_all_in_progress) < 0) {
- nm_assert (*out_refresh_all_in_progress > 0);
- *out_refresh_all_in_progress -= 1;
- }
+ if (_nl_send_nlmsg (platform,
+ nlmsg,
+ NULL,
+ NULL,
+ DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS,
+ out_refresh_all_in_progress) < 0)
+ goto next_after_fail;
+
+ continue;
+
+next_after_fail:
+ nm_assert (*out_refresh_all_in_progress > 0);
+ *out_refresh_all_in_progress -= 1;
}
}