Fixed three bugs found during code review:
1. Division by zero in normalize_pt(): Added check to return {0, 0}
when normalizing a zero-length vector, preventing NaN values in
sweep gradient rendering.
2. Memory leak in get_color_stops(): Now properly frees old memory
before reallocating and checks for malloc failure to prevent
null pointer dereference.
3. Integer division in helper_cairo_create_context(): Fixed missing
decimal point causing integer division (br / 255) instead of
floating-point division, which resulted in incorrect alpha
channel calculations for color blending.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>