diff --git a/libretroshare/src/grouter/grouteritems.cc b/libretroshare/src/grouter/grouteritems.cc index aa077b590..4f85bd429 100644 --- a/libretroshare/src/grouter/grouteritems.cc +++ b/libretroshare/src/grouter/grouteritems.cc @@ -346,12 +346,13 @@ RsGRouterGenericDataItem *RsGRouterGenericDataItem::duplicate() const // then duplicate the memory chunk - item->data_bytes = (uint8_t*)rs_malloc(data_size) ; - - if(item->data_bytes == NULL) - return NULL ; - - memcpy(item->data_bytes,data_bytes,data_size) ; + if(data_size > 0) + { + item->data_bytes = (uint8_t*)rs_malloc(data_size) ; + memcpy(item->data_bytes,data_bytes,data_size) ; + } + else + item->data_bytes = NULL ; return item ; }