summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netbytes.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/netbytes.c b/netbytes.c
index 07c1301..81ba4d0 100644
--- a/netbytes.c
+++ b/netbytes.c
@@ -539,14 +539,12 @@ int nb_load( netbyte_store *store, uint8_t *data )
{
case NBT_U8:
{
- nb_u8 *u8 = malloc( sizeof(nb_u8) );
+ nb_u8 u8;
- memcpy( u8, c, sizeof(nb_u8) );
+ memcpy( &u8, c, sizeof(nb_u8) );
c += sizeof(nb_u8);
- nb_add_u8( store, u8 );
-
- free(u8);
+ nb_add_u8( store, &u8 );
break;
}
@@ -572,12 +570,12 @@ int nb_load( netbyte_store *store, uint8_t *data )
}
case NBT_U16:
{
- nb_u16 *u16 = malloc( sizeof(nb_u16) );
+ nb_u16 u16;
- memcpy( u16, c, sizeof(nb_u16) );
+ memcpy( &u16, c, sizeof(nb_u16) );
c += sizeof(nb_u16);
- nb_add_u16( store, u16 );
+ nb_add_u16( store, &u16 );
break;
}
@@ -600,8 +598,6 @@ int nb_load( netbyte_store *store, uint8_t *data )
}
case NBT_U32:
{
- //FIXIT in all places
- //nb_u32 *u32 = malloc( sizeof(nb_u32) );
nb_u32 u32;
memcpy( &u32, c, sizeof(nb_u32) );
@@ -629,12 +625,12 @@ int nb_load( netbyte_store *store, uint8_t *data )
}
case NBT_U64:
{
- nb_u64 *u64 = malloc( sizeof(nb_u64) );
+ nb_u64 u64;
- memcpy( u64, c, sizeof(nb_u64) );
+ memcpy( &u64, c, sizeof(nb_u64) );
c += sizeof(nb_u64);
- nb_add_u64( store, u64 );
+ nb_add_u64( store, &u64 );
break;
}
case NBT_U64ARRAY: