are you sure you want to use SG_MALLOC here?
It should either be used everywhere in liblinear or nowhere.
Is SG_MALLOC used in other places?