pbuf_copy(): moved the check for "p_to != NULL" to a better place.

This commit is contained in:
goldsimon 2012-01-20 21:21:10 +01:00
parent 83b46811f9
commit be1dccd15e

View File

@ -863,7 +863,6 @@ pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)
/* iterate through pbuf chain */ /* iterate through pbuf chain */
do do
{ {
LWIP_ERROR("p_to != NULL", p_to != NULL, return ERR_ARG;);
/* copy one part of the original chain */ /* copy one part of the original chain */
if ((p_to->len - offset_to) >= (p_from->len - offset_from)) { if ((p_to->len - offset_to) >= (p_from->len - offset_from)) {
/* complete current p_from fits into current p_to */ /* complete current p_from fits into current p_to */
@ -880,6 +879,7 @@ pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)
/* on to next p_to (if any) */ /* on to next p_to (if any) */
offset_to = 0; offset_to = 0;
p_to = p_to->next; p_to = p_to->next;
LWIP_ERROR("p_to != NULL", p_to != NULL, return ERR_ARG;);
} }
LWIP_ASSERT("offset_from <= p_from->len", offset_from <= p_from->len); LWIP_ASSERT("offset_from <= p_from->len", offset_from <= p_from->len);
if (offset_from >= p_from->len) { if (offset_from >= p_from->len) {