Permalink
Browse files

Fix memory leaks on error

  • Loading branch information...
gogglesguy authored and rouault committed Aug 19, 2015
1 parent 51bd4d7 commit f103b421dee8051cb91cbf50d90587fccf03e626
Showing with 11 additions and 0 deletions.
  1. +3 −0 mapagg.cpp
  2. +8 −0 mapogr.cpp
@@ -822,6 +822,8 @@ imageObj *agg2CreateImage(int width, int height, outputFormatObj *format, colorO
if( (AGG_INT64U)bufSize != bufSize64 ) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating " AGG_INT64U_FRMT " bytes.\n", "agg2CreateImage()",
__FILE__, __LINE__, bufSize64);
free(image);
delete r;
return NULL;
}
@@ -830,6 +832,7 @@ imageObj *agg2CreateImage(int width, int height, outputFormatObj *format, colorO
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating " AGG_INT64U_FRMT " bytes.\n", "agg2CreateImage()",
__FILE__, __LINE__, bufSize64);
free(image);
delete r;
return NULL;
}
r->m_rendering_buffer.attach(r->buffer, width, height, width * 4);
@@ -901,6 +901,14 @@ static char **msOGRGetValues(layerObj *layer, OGRFeatureH hFeature)
msDebug(MSOGR_SYMBOLPARAMNAME " = \"%s\"\n", values[i]);
}
else {
msFreeCharArray(values,i);
OGR_SM_Destroy(hStyleMgr);
OGR_ST_Destroy(hLabelStyle);
OGR_ST_Destroy(hPenStyle);
OGR_ST_Destroy(hBrushStyle);
OGR_ST_Destroy(hSymbolStyle);
msSetError(MS_OGRERR,"Invalid field index!?!","msOGRGetValues()");
return(NULL);
}

0 comments on commit f103b42

Please sign in to comment.