[socket-nif] Fix memorys leaks in recv error cases
[socket-nif] Fix memorys leaks in recv error cases

and collapsed some duplicate code

getong/otp,rlipscombe/otp,lrascao/otp,rlipscombe/otp,erlang/otp,bsmr-erlang/otp,vladdu/otp,electricimp/otp,electricimp/otp,g-andrade/otp,rlipscombe/otp,bjorng/otp,vinoski/otp,kvakvs/otp,emacsmirror/erlang,kvakvs/otp,bsmr-erlang/otp,vinoski/otp,mikpe/otp,isvilen/otp,mikpe/otp,bjorng/otp,dumbbell/otp,emacsmirror/erlang,mikpe/otp,mikpe/otp,dumbbell/otp,potatosalad/otp,erlang/otp,kvakvs/otp,erlang/otp,ferd/otp,kvakvs/otp,g-andrade/otp,rlipscombe/otp,getong/otp,legoscia/otp,bjorng/otp,erlang/otp,lrascao/otp,dumbbell/otp,rlipscombe/otp,jj1bdx/otp,lrascao/otp,jj1bdx/otp,isvilen/otp,emacsmirror/erlang,electricimp/otp,bsmr-erlang/otp,vladdu/otp,rlipscombe/otp,emacsmirror/erlang,aboroska/otp,g-andrade/otp,erlang/otp,mikpe/otp,getong/otp,ferd/otp,potatosalad/otp,legoscia/otp,electricimp/otp,jj1bdx/otp,ferd/otp,dumbbell/otp,electricimp/otp,uabboli/otp,dumbbell/otp,isvilen/otp,legoscia/otp,erlang/otp,lrascao/otp,vladdu/otp,RoadRunnr/otp,dumbbell/otp,aboroska/otp,jj1bdx/otp,getong/otp,bjorng/otp,electricimp/otp,lrascao/otp,uabboli/otp,ferd/otp,kvakvs/otp,bjorng/otp,g-andrade/otp,isvilen/otp,dgud/otp,bsmr-erlang/otp,dgud/otp,potatosalad/otp,bsmr-erlang/otp,vladdu/otp,erlang/otp,dumbbell/otp,aboroska/otp,getong/otp,aboroska/otp,mikpe/otp,RoadRunnr/otp,potatosalad/otp,ferd/otp,mikpe/otp,aboroska/otp,potatosalad/otp,uabboli/otp,vinoski/otp,electricimp/otp,RoadRunnr/otp,electricimp/otp,legoscia/otp,erlang/otp,mikpe/otp,bsmr-erlang/otp,getong/otp,vladdu/otp,aboroska/otp,RoadRunnr/otp,jj1bdx/otp,ferd/otp,erlang/otp,erlang/otp,g-andrade/otp,vinoski/otp,dgud/otp,dgud/otp,RoadRunnr/otp,bsmr-erlang/otp,jj1bdx/otp,RoadRunnr/otp,dumbbell/otp,emacsmirror/erlang,vinoski/otp,vladdu/otp,aboroska/otp,isvilen/otp,vinoski/otp,legoscia/otp,legoscia/otp,potatosalad/otp,lrascao/otp,jj1bdx/otp,uabboli/otp,rlipscombe/otp,jj1bdx/otp,uabboli/otp,dumbbell/otp,legoscia/otp,bjorng/otp,kvakvs/otp,vinoski/otp,getong/otp,vinoski/otp,aboroska/otp,electricimp/otp,potatosalad/otp,uabboli/otp,isvilen/otp,bjorng/otp,getong/otp,bjorng/otp,jj1bdx/otp,g-andrade/otp,potatosalad/otp,dgud/otp,uabboli/otp,legoscia/otp,vinoski/otp,mikpe/otp,RoadRunnr/otp,g-andrade/otp,lrascao/otp,dgud/otp,ferd/otp,uabboli/otp,emacsmirror/erlang,bsmr-erlang/otp,getong/otp,emacsmirror/erlang,emacsmirror/erlang,emacsmirror/erlang,bjorng/otp,mikpe/otp,isvilen/otp,lrascao/otp,vladdu/otp,kvakvs/otp,ferd/otp,isvilen/otp,vladdu/otp,isvilen/otp,kvakvs/otp,getong/otp,g-andrade/otp,dgud/otp,RoadRunnr/otp,RoadRunnr/otp,ferd/otp,bjorng/otp,bsmr-erlang/otp,g-andrade/otp,potatosalad/otp,rlipscombe/otp,rlipscombe/otp,dumbbell/otp,vinoski/otp,g-andrade/otp,uabboli/otp,dgud/otp,aboroska/otp,dgud/otp,kvakvs/otp,jj1bdx/otp,dgud/otp,rlipscombe/otp,emacsmirror/erlang,lrascao/otp,vladdu/otp,potatosalad/otp,legoscia/otp,isvilen/otp