use new malloc/free wrapper

This commit is contained in:
Olaf Bergmann committed 2010-07-12 17:18:48 +02:00
1 parent 0c2e226e9f
commit 28a14dbb11
2 files changed
+10 -8

No files matched your search

+7 -6
View File
@@ -13,6 +13,7 @@
#include <arpa/inet.h>
#include "debug.h"
#include "mem.h"
#include "net.h"
#define options_start(p) ((coap_opt_t *) ( (unsigned char *)p->hdr + sizeof ( coap_hdr_t ) ))
@@ -150,8 +151,8 @@ coap_delete_node(coap_queue_t *node) {
if ( !node )
return 0;
free( node->pdu );
free( node );
coap_free( node->pdu );
coap_free( node );
return 1;
}
@@ -168,7 +169,7 @@ coap_delete_all(coap_queue_t *queue) {
coap_queue_t *
coap_new_node() {
coap_queue_t *node = malloc ( sizeof *node );
coap_queue_t *node = coap_malloc ( sizeof *node );
if ( ! node ) {
perror ("coap_new_node: malloc");
return NULL;
@@ -201,7 +202,7 @@ coap_pop_next( coap_context_t *context ) {
coap_context_t *
coap_new_context(in_port_t port) {
coap_context_t *c = malloc( sizeof( coap_context_t ) );
coap_context_t *c = coap_malloc( sizeof( coap_context_t ) );
struct sockaddr_in6 addr;
time_t now;
int reuse = 1, need_port = 1;
@@ -250,7 +251,7 @@ coap_new_context(in_port_t port) {
onerror:
if ( c->sockfd >= 0 )
close ( c->sockfd );
free( c );
coap_free( c );
return NULL;
}
@@ -261,7 +262,7 @@ coap_free_context( coap_context_t *context ) {
coap_delete_all(context->sendqueue);
close( context->sockfd );
free( context );
coap_free( context );
}
#ifdef __STRICT_ANSI__
+3 -2
View File
@@ -9,12 +9,13 @@
#include <arpa/inet.h>
#include "debug.h"
#include "mem.h"
#include "pdu.h"
coap_pdu_t *
coap_new_pdu() {
coap_pdu_t *pdu = malloc( sizeof(coap_pdu_t) + COAP_MAX_PDU_SIZE );
coap_pdu_t *pdu = coap_malloc( sizeof(coap_pdu_t) + COAP_MAX_PDU_SIZE );
if (!pdu) {
perror("new_pdu: malloc");
return NULL;
@@ -36,7 +37,7 @@ coap_new_pdu() {
void
coap_delete_pdu(coap_pdu_t *pdu) {
free( pdu );
coap_free( pdu );
}
#define options_start(p) ((coap_opt_t *) ( (unsigned char *)p->hdr + sizeof ( coap_hdr_t ) ))