Add mbuf documentation. have mbuf_free handle NULL pointer

This commit is contained in:
Nils O. Selåsdal
2013-09-13 21:42:32 +02:00
parent 88a20409cf
commit 9e919c1cde
2 changed files with 124 additions and 8 deletions
+7 -5
View File
@@ -86,11 +86,13 @@ struct MBuf *uc_mbuf_new_inline_hr(uint32_t len, uint32_t headroom)
void uc_mbuf_free(struct MBuf *mbuf)
{
if (mbuf->flags & (UC_MBUF_FL_MALLOC | UC_MBUF_FL_MALLOC_BUF))
free(mbuf->bufstart);
if (mbuf->flags & (UC_MBUF_FL_MALLOC | UC_MBUF_FL_MALLOC_INLINE))
free(mbuf);
if (mbuf != NULL) {
if (mbuf->flags & (UC_MBUF_FL_MALLOC | UC_MBUF_FL_MALLOC_BUF))
free(mbuf->bufstart);
if (mbuf->flags & (UC_MBUF_FL_MALLOC | UC_MBUF_FL_MALLOC_INLINE))
free(mbuf);
}
}
void uc_mbuf_zero(struct MBuf *mbuf)