Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/nanosvg.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,12 @@ static NSVGparser* nsvg__createParser()
NSVGparser* p;
p = (NSVGparser*)malloc(sizeof(NSVGparser));
if (p == NULL) goto error;
// cppcheck-suppress memsetClassFloat
memset(p, 0, sizeof(NSVGparser));

p->image = (NSVGimage*)malloc(sizeof(NSVGimage));
if (p->image == NULL) goto error;
// cppcheck-suppress memsetClassFloat
memset(p->image, 0, sizeof(NSVGimage));

// Init style
Expand Down Expand Up @@ -947,6 +949,7 @@ static void nsvg__addShape(NSVGparser* p)

shape = (NSVGshape*)malloc(sizeof(NSVGshape));
if (shape == NULL) goto error;
// cppcheck-suppress memsetClassFloat
memset(shape, 0, sizeof(NSVGshape));

memcpy(shape->id, attr->id, sizeof shape->id);
Expand Down Expand Up @@ -1042,6 +1045,7 @@ static void nsvg__addPath(NSVGparser* p, char closed)

path = (NSVGpath*)malloc(sizeof(NSVGpath));
if (path == NULL) goto error;
// cppcheck-suppress memsetClassFloat
memset(path, 0, sizeof(NSVGpath));

path->pts = (float*)malloc(p->npts*2*sizeof(float));
Expand Down Expand Up @@ -2553,6 +2557,7 @@ static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
int i;
NSVGgradientData* grad = (NSVGgradientData*)malloc(sizeof(NSVGgradientData));
if (grad == NULL) return;
// cppcheck-suppress memsetClassFloat
memset(grad, 0, sizeof(NSVGgradientData));
grad->units = NSVG_OBJECT_SPACE;
grad->type = type;
Expand Down Expand Up @@ -2935,6 +2940,7 @@ NSVGpath* nsvgDuplicatePath(NSVGpath* p)

res = (NSVGpath*)malloc(sizeof(NSVGpath));
if (res == NULL) goto error;
// cppcheck-suppress memsetClassFloat
memset(res, 0, sizeof(NSVGpath));

res->pts = (float*)malloc(p->npts*2*sizeof(float));
Expand Down
1 change: 1 addition & 0 deletions src/nanosvgrast.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ NSVGrasterizer* nsvgCreateRasterizer()
{
NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer));
if (r == NULL) goto error;
// cppcheck-suppress memsetClassFloat
memset(r, 0, sizeof(NSVGrasterizer));

r->tessTol = 0.25f;
Expand Down