Skip to content

Commit 4fb1457

Browse files
committed
Fix errors found by cppcheck
1 parent 8feb65f commit 4fb1457

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/RenderManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ void RenderManager::drawPolygon(std::vector<int> withArrayOfCoordinates, unsigne
400400
glVertexPointer(3, GL_FLOAT, 0, spotVertCoords);
401401
glDrawArrays(GL_TRIANGLE_FAN, 0, sizeOfArray >> 1);
402402

403-
delete spotVertCoords;
403+
delete[] spotVertCoords;
404404

405405
glPopMatrix();
406406
}

src/stb_image.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3299,7 +3299,10 @@ static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
32993299
skip(s, tga_palette_start );
33003300
// load the palette
33013301
tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );
3302-
if (!tga_palette) return epuc("outofmem", "Out of memory");
3302+
if (!tga_palette) {
3303+
free(tga_data);
3304+
return epuc("outofmem", "Out of memory");
3305+
}
33033306
if (!getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 )) {
33043307
free(tga_data);
33053308
free(tga_palette);

0 commit comments

Comments
 (0)