fixed bug probably responsible for random crashes in DHT code

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-05-03 19:29:38 +00:00
parent 08e74f2dba
commit 16501f62dd

View File

@ -209,7 +209,10 @@ static be_node *_be_decode(const char **data, long long *data_len)
#ifdef BE_DEBUG_DECODE
fprintf(stderr, "bencode::_be_decode() dictionary get val\n");
#endif
ret->val.d[i].val = _be_decode(data, data_len);
ret->val.d[i ].val = _be_decode(data, data_len);
ret->val.d[i+1].val = NULL ; // ensures termination of loops based on 0x0 value, otherwise, uninitialized
// memory occurs if(ret->val.d[i].key == 0x0 && ret->val.d[i].val != NULL)
// when calling be_free 8 lines below this point...
if ((ret->val.d[i].key == NULL) || (ret->val.d[i].val == NULL))
{