fixed bug due to not using realloc correctly (thanks valgrind)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6385 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-05-30 19:43:05 +00:00
parent 0d3d8ed2bd
commit b4f26dcf8f
2 changed files with 7 additions and 10 deletions

View file

@ -876,15 +876,9 @@ void ops_keyring_remove_key(ops_keyring_t *keyring,int index)
ops_keydata_copy(&keyring->keys[index],&keyring->keys[keyring->nkeys-1]) ;
keydata_internal_free(&keyring->keys[keyring->nkeys-1]) ;
if(NULL == realloc(keyring->keys,(keyring->nkeys-1)*sizeof(ops_keydata_t)) )
{
fprintf(stderr,"ops_keyring_remove_key: ERROR: cannot re-alloc keyring memory.") ;
return ;
}
keyring->nkeys-- ;
keyring->nkeys_allocated-- ;
// keyring->nkeys_allocated is left untouched intentionnaly.
}
/**