Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d.vect: Dereference after Null Check #4640

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Changes Requested
Shubham Vasudeo Desai committed Dec 2, 2024
commit c466361c9663e48a7b0ba34cd35cb78c562e5d94
33 changes: 16 additions & 17 deletions display/d.vect/lines.c
Original file line number Diff line number Diff line change
@@ -345,30 +345,28 @@ int draw_line(int type, int ltype, int line, const struct line_pnts *Points,
D_symbol(Symb, x0, y0, line_color, fill_color);
}
}
else {
G_warning(_("Symbol is NULL; unable to display points"));
}

/* reset to defaults */
var_size = size;
rotation = 0.0;
}
else if (color || custom_rgb || zcolors) {
if (!cvarr_rgb && !cats_color_flag && !zcolors && !colors)
D_RGB_color(color->r, color->g, color->b);
else {
if (custom_rgb)
D_RGB_color((unsigned char)red, (unsigned char)grn,
(unsigned char)blu);
else
if (color) {
if (!cvarr_rgb && !cats_color_flag && !zcolors && !colors)
D_RGB_color(color->r, color->g, color->b);
}
else {
if (custom_rgb)
D_RGB_color((unsigned char)red, (unsigned char)grn,
(unsigned char)blu);
else
D_RGB_color(color->r, color->g, color->b);
}

/* Plot the lines */
if (Points->n_points == 1) /* line with one coor */
D_polydots_abs(x, y, Points->n_points);
else /* use different user defined render methods */
D_polyline_abs(x, y, Points->n_points);
/* Plot the lines */
if (Points->n_points == 1) /* line with one coor */
D_polydots_abs(x, y, Points->n_points);
else /* use different user defined render methods */
D_polyline_abs(x, y, Points->n_points);
}
}

switch (ltype) {
@@ -391,5 +389,6 @@ int draw_line(int type, int ltype, int line, const struct line_pnts *Points,
break;
}

G_free(Symb);
return 1;
}