Free the net buffer and its associated NET_VECTOR. Decrease the reference count of the net buffer by one. Free the associated net vector and itself if the reference count of the net buffer is decreased to 0. The net vector free operation just decrease the reference count of the net vector by one and do the real resource free operation when the reference count of the net vector is
| 195 | |
| 196 | **/ |
| 197 | VOID |
| 198 | EFIAPI |
| 199 | NetbufFree ( |
| 200 | IN NET_BUF *Nbuf |
| 201 | ) |
| 202 | { |
| 203 | ASSERT (Nbuf != NULL); |
| 204 | NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); |
| 205 | ASSERT (Nbuf->RefCnt > 0); |
| 206 | |
| 207 | Nbuf->RefCnt--; |
| 208 | |
| 209 | if (Nbuf->RefCnt == 0) { |
| 210 | // |
| 211 | // Update Vector only when NBuf is to be released. That is, |
| 212 | // all the sharing of Nbuf increse Vector's RefCnt by one |
| 213 | // |
| 214 | NetbufFreeVector (Nbuf->Vector); |
| 215 | FreePool (Nbuf); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | |
| 220 | /** |
no test coverage detected