Merge pull request #11414 from donaldsharp/memory_cannot_fail

Memory cannot fail
This commit is contained in:
Rafael Zalamena 2022-06-16 10:58:05 -03:00 committed by GitHub
commit 952071e44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 18 deletions

View File

@ -145,8 +145,7 @@ struct stream *stream_dup(const struct stream *s)
STREAM_VERIFY_SANE(s);
if ((snew = stream_new(s->endp)) == NULL)
return NULL;
snew = stream_new(s->endp);
return (stream_copy(snew, s));
}

View File

@ -1294,10 +1294,6 @@ static void zebra_ptm_send_bfdd(struct stream *msg)
/* Create copy for replication. */
msgc = stream_dup(msg);
if (msgc == NULL) {
zlog_debug("%s: not enough memory", __func__);
return;
}
/* Send message to all running BFDd daemons. */
for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) {
@ -1308,10 +1304,6 @@ static void zebra_ptm_send_bfdd(struct stream *msg)
/* Allocate more messages. */
msg = stream_dup(msgc);
if (msg == NULL) {
zlog_debug("%s: not enough memory", __func__);
return;
}
}
stream_free(msgc);
@ -1326,10 +1318,6 @@ static void zebra_ptm_send_clients(struct stream *msg)
/* Create copy for replication. */
msgc = stream_dup(msg);
if (msgc == NULL) {
zlog_debug("%s: not enough memory", __func__);
return;
}
/* Send message to all running client daemons. */
for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) {
@ -1340,10 +1328,6 @@ static void zebra_ptm_send_clients(struct stream *msg)
/* Allocate more messages. */
msg = stream_dup(msgc);
if (msg == NULL) {
zlog_debug("%s: not enough memory", __func__);
return;
}
}
stream_free(msgc);