From 23156ab4b1bd122b5257e541fff72e388c796dbc Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 3 Jun 2017 10:30:02 +0200 Subject: [PATCH] fixed malloc problem when chat avatar is missing --- libretroshare/src/chat/p3chatservice.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libretroshare/src/chat/p3chatservice.cc b/libretroshare/src/chat/p3chatservice.cc index 851b2983d..64c4e9534 100644 --- a/libretroshare/src/chat/p3chatservice.cc +++ b/libretroshare/src/chat/p3chatservice.cc @@ -169,6 +169,12 @@ class p3ChatService::AvatarInfo void toUnsignedChar(unsigned char *& data,uint32_t& size) const { + if(_image_size == 0) + { + size = 0 ; + data = NULL ; + return ; + } data = (unsigned char *)rs_malloc(_image_size) ; size = _image_size ; memcpy(data,_image_data,size*sizeof(unsigned char)) ;