From: John Darrington <john@darrington.wattle.id.au>
Date: Wed, 26 May 2010 20:02:39 +0000 (+0200)
Subject: Removed uninitialised variable.
X-Git-Tag: v0.7.6~394
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50d8ca1f180c3ce67532eb186a8a5c372f2f08e9;p=pspp-builds.git

Removed uninitialised variable.

Removed an uninitialised variable which was being
dereferenced and hence crashing.
---

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;