/* empty path is permitted it just disables the path */
palloc = dom_string_byte_length(path_d_str);
if (palloc == 0) {
+ dom_string_unref(path_d_str);
svgtiny_cleanup_state_local(&state);
return svgtiny_OK;
}
&x, &y, &n) == 7);
} else {
- fprintf(stderr, "parse failed at \"%s\"\n", s);
+ /* fprintf(stderr, "parse failed at \"%s\"\n", s); */
break;
}
}
(const uint8_t *) s,
strcspn(s, "; "),
&value);
- if (exc != DOM_NO_ERR &&
+ if (exc == DOM_NO_ERR &&
value != NULL) {
svgtiny_parse_color(value,
&color,
gradient_norm_squared = gradient_dx * gradient_dx +
gradient_dy * gradient_dy;
pts = svgtiny_list_create(sizeof (struct grad_point));
- if (!pts)
+ if (!pts) {
+ free(p);
return svgtiny_OUT_OF_MEMORY;
+ }
for (j = 0; j != n; ) {
int segment_type = (int) p[j];
struct grad_point *point;
gradient_norm_squared;
point = svgtiny_list_push(pts);
if (!point) {
+ free(p);
svgtiny_list_free(pts);
return svgtiny_OUT_OF_MEMORY;
}
#endif
point = svgtiny_list_push(pts);
if (!point) {
+ free(p);
svgtiny_list_free(pts);
return svgtiny_OUT_OF_MEMORY;
}
/* There must be at least a single point for the gradient */
if (svgtiny_list_size(pts) == 0) {
svgtiny_list_free(pts);
+ free(p);
return svgtiny_OK;
}