From 50d8ca1f180c3ce67532eb186a8a5c372f2f08e9 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 26 May 2010 22:02:39 +0200 Subject: [PATCH] Removed uninitialised variable. Removed an uninitialised variable which was being dereferenced and hence crashing. --- src/output/charts/np-plot-cairo.c | 5 ++--- src/output/charts/np-plot.c | 3 +-- src/output/charts/np-plot.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/output/charts/np-plot-cairo.c b/src/output/charts/np-plot-cairo.c index a9186527..8c96b73f 100644 --- a/src/output/charts/np-plot-cairo.c +++ b/src/output/charts/np-plot-cairo.c @@ -34,7 +34,7 @@ np_plot_chart_draw (const struct chart_item *chart_item, cairo_t *cr, struct casereader *data; struct ccase *c; - xrchart_write_title (cr, geom, _("Normal Q-Q Plot of %s"), npp->label); + xrchart_write_title (cr, geom, _("Normal Q-Q Plot of %s"), chart_item->title); xrchart_write_xlabel (cr, geom, _("Observed Value")); xrchart_write_ylabel (cr, geom, _("Expected Normal")); xrchart_write_xscale (cr, geom, @@ -61,8 +61,7 @@ dnp_plot_chart_draw (const struct chart_item *chart_item, cairo_t *cr, struct casereader *data; struct ccase *c; - xrchart_write_title (cr, geom, _("Detrended Normal Q-Q Plot of %s"), - dnpp->label); + xrchart_write_title (cr, geom, _("Detrended Normal Q-Q Plot of %s"), chart_item->title); xrchart_write_xlabel (cr, geom, _("Observed Value")); xrchart_write_ylabel (cr, geom, _("Dev from Normal")); xrchart_write_xscale (cr, geom, dnpp->y_min, dnpp->y_max, 5); diff --git a/src/output/charts/np-plot.c b/src/output/charts/np-plot.c index e912479a..dfc74603 100644 --- a/src/output/charts/np-plot.c +++ b/src/output/charts/np-plot.c @@ -36,7 +36,7 @@ make_np_plot (const struct np *np, const struct casereader *reader, if (np->n < 1.0) return NULL; - npp = xmalloc (sizeof *npp); + npp = xzalloc (sizeof *npp); chart_item_init (&npp->chart_item, &np_plot_chart_class, label); npp->data = casereader_clone (reader); npp->y_min = np->y_min; @@ -97,7 +97,6 @@ np_plot_chart_destroy (struct chart_item *chart_item) { struct np_plot_chart *npp = to_np_plot_chart (chart_item); casereader_destroy (npp->data); - free (npp->label); free (npp); } diff --git a/src/output/charts/np-plot.h b/src/output/charts/np-plot.h index 82194e20..82c81ed8 100644 --- a/src/output/charts/np-plot.h +++ b/src/output/charts/np-plot.h @@ -25,7 +25,6 @@ struct np; struct np_plot_chart { struct chart_item chart_item; - char *label; struct casereader *data; bool detrended; -- 2.30.2