lib: fixed bad mallocs in socket

Signed-off-by: Morriar <morriar@dionysos.(none)>