Fixed memory allocation bug in shapefile.cpp