Added checks for possible handle hashtable_add() failure

Added checks for possible handle hashtable_add() failure with key,
value and copyfn