diff options
author | James Bursa <james@netsurf-browser.org> | 2007-12-11 04:06:49 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2007-12-11 04:06:49 +0000 |
commit | 4525ffbd913a6c0027747f3d7dd0d2386fbe1d9f (patch) | |
tree | 0cc01adc9bbc4d0c914fc43fabc54d02f67da30f | |
parent | 9125ffa7d8b61d5b534a8a44bfae7e6dcfe47199 (diff) | |
download | netsurf-4525ffbd913a6c0027747f3d7dd0d2386fbe1d9f.tar.gz netsurf-4525ffbd913a6c0027747f3d7dd0d2386fbe1d9f.tar.bz2 |
Plug a memory leak in ro_plot_path().
svn path=/trunk/netsurf/; revision=3665
-rw-r--r-- | riscos/plotters.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/riscos/plotters.c b/riscos/plotters.c index 36518b77b..124774450 100644 --- a/riscos/plotters.c +++ b/riscos/plotters.c @@ -226,7 +226,7 @@ bool ro_plot_path(float *p, unsigned int n, colour fill, float width, static const draw_line_style line_style = { draw_JOIN_MITRED, draw_CAP_BUTT, draw_CAP_BUTT, 0, 0x7fffffff, 0, 0, 0, 0 }; - int *path; + int *path = 0; unsigned int i; os_trfm trfm; os_error *error; @@ -236,13 +236,13 @@ bool ro_plot_path(float *p, unsigned int n, colour fill, float width, if (p[0] != PLOTTER_PATH_MOVE) { LOG(("path doesn't start with a move")); - return false; + goto error; } path = malloc(sizeof *path * (n + 10)); if (!path) { LOG(("out of memory")); - return false; + goto error; } for (i = 0; i < n; ) { @@ -270,7 +270,7 @@ bool ro_plot_path(float *p, unsigned int n, colour fill, float width, i += 7; } else { LOG(("bad path command %f", p[i])); - return false; + goto error; } } path[i] = draw_END_PATH; @@ -289,14 +289,14 @@ bool ro_plot_path(float *p, unsigned int n, colour fill, float width, if (error) { LOG(("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess)); - return false; + goto error; } error = xdraw_fill((draw_path *) path, 0, &trfm, 0); if (error) { LOG(("xdraw_stroke: 0x%x: %s", error->errnum, error->errmess)); - return false; + goto error; } } @@ -306,7 +306,7 @@ bool ro_plot_path(float *p, unsigned int n, colour fill, float width, if (error) { LOG(("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess)); - return false; + goto error; } error = xdraw_stroke((draw_path *) path, 0, &trfm, 0, @@ -314,11 +314,15 @@ bool ro_plot_path(float *p, unsigned int n, colour fill, float width, if (error) { LOG(("xdraw_stroke: 0x%x: %s", error->errnum, error->errmess)); - return false; + goto error; } } return true; + +error: + free(path); + return false; } |