#ifdef __REACTOS__
#define MCLGET(m, how) { \
OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \
- (m)->m_data = (m)->m_ext.ext_buf = malloc(MCLBYTES); \
- (m)->m_flags |= M_EXT; \
- (m)->m_ext.ext_size = MCLBYTES; \
+ (m)->m_ext.ext_buf = malloc(MCLBYTES); \
+ if ((m)->m_ext.ext_buf != NULL) { \
+ (m)->m_data = (m)->m_ext.ext_buf; \
+ (m)->m_flags |= M_EXT; \
+ (m)->m_ext.ext_size = MCLBYTES; \
+ } \
}
#define MCLFREE(p) { \
#ifdef __REACTOS__
if( OtcpEvent.PacketSend ) {
struct mbuf *new_m;
- MGET( new_m, M_DONTWAIT, 0 );
+ new_m = m_get( M_DONTWAIT, 0 );
+ if ( NULL == new_m ) {
+ error = ENOBUFS;
+ goto done;
+ }
MCLGET( new_m, M_DONTWAIT );
+ if (0 == (new_m->m_flags & M_EXT)) {
+ m_free( new_m );
+ error = ENOBUFS;
+ goto done;
+ }
m_copydata( m, 0, htons(ip->ip_len), new_m->m_data );
new_m->m_len = htons(ip->ip_len);
error = OtcpEvent.PacketSend( OtcpEvent.ClientData,
if( error == 0 && OtcpEvent.PacketSend ) {
struct mbuf *new_m;
MGET( new_m, M_DONTWAIT, 0 );
+ if ( NULL == new_m ) {
+ error = ENOBUFS;
+ goto done;
+ }
MCLGET( new_m, M_DONTWAIT );
+ if (0 == (new_m->m_flags & M_EXT)) {
+ m_free( new_m );
+ error = ENOBUFS;
+ goto done;
+ }
m_copydata( m, 0, htons(ip->ip_len), new_m->m_data );
new_m->m_len = htons(ip->ip_len);
error = OtcpEvent.PacketSend( OtcpEvent.ClientData,