Commit 9517c2eb authored by Morten Welinder's avatar Morten Welinder

Cppcheck: fixes from Mario Rugiero <mrugiero@gmail.com>

parent 752fecd5
2013-12-12 Mario Rugiero <mrugiero@gmail.com>
* */*.c: Fix some leaks and null dereferences pointed out by
cppcheck.
2013-12-12 Morten Welinder <terra@gnome.org>
* src/parser.y (array_row): Avoid overrunning string when multiple
......
......@@ -3,6 +3,9 @@ Gnumeric 1.12.10
Andreas:
* Fix handling of dashes on ODF import. [#719509]
Mario Rugiero:
* Fix leaks. [#720306]
Morten:
* Extend POCHHAMMER to negative values.
* Improve accuracy of BETA and BETALN.
......
......@@ -1614,11 +1614,13 @@ static void
excel_read_FONT (BiffQuery *q, GnmXLImporter *importer)
{
MsBiffVersion const ver = importer->ver;
ExcelFont *fd = g_new (ExcelFont, 1);
ExcelFont *fd;
guint16 data;
guint8 data1;
XL_CHECK_CONDITION (q->length >= 4);
fd = g_new (ExcelFont, 1);
fd->height = GSF_LE_GET_GUINT16 (q->data + 0);
data = GSF_LE_GET_GUINT16 (q->data + 2);
fd->italic = (data & 0x2) == 0x2;
......
......@@ -110,8 +110,8 @@ static void destruct_xloper(XLOPER*x){
case xltypeInt: break;
default: unsupported_xloper_type(x);
}
x->xltype=xltypeNil;
}
x->xltype=xltypeNil;
}
static void copy_construct_xloper(XLOPER*x,const XLOPER*y){
......
......@@ -222,7 +222,10 @@ dialog_chi_square_tool (WBCGtk *wbcg, Sheet *sheet, gboolean independence)
NULL,
G_CALLBACK (chi_squared_tool_update_sensitivity_cb),
GNM_EE_SINGLE_RANGE))
{
g_free(state);
return 0;
}
if (independence)
type ="test-of-independence";
......
......@@ -261,7 +261,10 @@ dialog_frequency_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (frequency_tool_ok_clicked_cb), NULL,
G_CALLBACK (frequency_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->predetermined_button = tool_setup_update
(&state->base, "pre_determined_button",
......
......@@ -629,7 +629,10 @@ dialog_kaplan_meier_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (kaplan_meier_tool_ok_clicked_cb), NULL,
G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
......
......@@ -204,7 +204,10 @@ dialog_normality_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (normality_tool_ok_clicked_cb), NULL,
G_CALLBACK (normality_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->alpha_entry = tool_setup_update
......
......@@ -228,7 +228,10 @@ dialog_one_mean_test_tool (WBCGtk *wbcg, Sheet *sheet)
NULL,
G_CALLBACK (one_mean_test_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->alpha_entry = tool_setup_update
......
......@@ -261,7 +261,10 @@ dialog_sign_test_two_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type type)
NULL,
G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
GNM_EE_SINGLE_RANGE))
{
g_free(state);
return 0;
}
state->alpha_entry = tool_setup_update
......@@ -406,7 +409,10 @@ dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type type)
NULL,
G_CALLBACK (sign_test_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->alpha_entry = tool_setup_update
......
......@@ -1234,7 +1234,10 @@ dialog_descriptive_stat_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (cb_desc_stat_tool_ok_clicked), NULL,
G_CALLBACK (desc_stat_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->summary_stats_button = go_gtk_builder_get_widget
(state->base.gui, "summary_stats_button");
......@@ -1616,7 +1619,10 @@ dialog_ttest_tool (WBCGtk *wbcg, Sheet *sheet, ttest_type test)
G_CALLBACK (ttest_tool_ok_clicked_cb), NULL,
G_CALLBACK (ttest_update_sensitivity_cb),
GNM_EE_SINGLE_RANGE))
{
g_free(state);
return 0;
}
state->paired_button = go_gtk_builder_get_widget (state->base.gui, "paired-button");
state->unpaired_button = go_gtk_builder_get_widget (state->base.gui, "unpaired-button");
......@@ -1803,7 +1809,10 @@ dialog_ftest_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (ftest_tool_ok_clicked_cb), NULL,
G_CALLBACK (ftest_update_sensitivity_cb),
GNM_EE_SINGLE_RANGE))
{
g_free(state);
return 0;
}
state->alpha_entry = go_gtk_builder_get_widget (state->base.gui, "one_alpha");
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
......@@ -2058,7 +2067,10 @@ dialog_sampling_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (sampling_tool_ok_clicked_cb), NULL,
G_CALLBACK (sampling_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->periodic_button = go_gtk_builder_get_widget (state->base.gui, "periodic-button");
state->random_button = go_gtk_builder_get_widget (state->base.gui, "random-button");
......@@ -2417,7 +2429,10 @@ dialog_regression_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (regression_tool_ok_clicked_cb), NULL,
G_CALLBACK (regression_tool_update_sensitivity_cb),
GNM_EE_SINGLE_RANGE))
{
g_free(state);
return 0;
}
state->confidence_entry = go_gtk_builder_get_widget (state->base.gui, "confidence-entry");
float_to_entry (GTK_ENTRY (state->confidence_entry), 0.95);
......@@ -2727,7 +2742,10 @@ dialog_exp_smoothing_tool (WBCGtk *wbcg, Sheet *sheet)
NULL,
G_CALLBACK (exp_smoothing_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->damping_fact_entry = go_gtk_builder_get_widget (state->base.gui,
"damping-fact-spin");
......@@ -3097,7 +3115,10 @@ dialog_average_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (average_tool_ok_clicked_cb), NULL,
G_CALLBACK (average_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->interval_entry = go_gtk_builder_get_widget (state->base.gui, "interval-entry");
int_to_entry (GTK_ENTRY (state->interval_entry), 3);
......@@ -3364,7 +3385,10 @@ dialog_histogram_tool (WBCGtk *wbcg, Sheet *sheet)
G_CALLBACK (histogram_tool_ok_clicked_cb), NULL,
G_CALLBACK (histogram_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->predetermined_button = GTK_WIDGET (go_gtk_builder_get_widget
(state->base.gui,
......@@ -3543,7 +3567,10 @@ dialog_anova_single_factor_tool (WBCGtk *wbcg, Sheet *sheet)
NULL,
G_CALLBACK (anova_single_tool_update_sensitivity_cb),
0))
{
g_free(state);
return 0;
}
state->alpha_entry = go_gtk_builder_get_widget (state->base.gui,
"alpha-entry");
......@@ -3772,7 +3799,10 @@ dialog_anova_two_factor_tool (WBCGtk *wbcg, Sheet *sheet)
NULL,
G_CALLBACK (anova_two_factor_tool_update_sensitivity_cb),
GNM_EE_SINGLE_RANGE))
{
g_free(state);
return 0;
}
state->alpha_entry = go_gtk_builder_get_widget (state->base.gui,
"alpha-entry");
......
......@@ -399,7 +399,10 @@ dialog_scenario_add (WBCGtk *wbcg)
G_CALLBACK (scenario_add_ok_clicked_cb), NULL,
G_CALLBACK (scenario_add_update_sensitivity_cb),
GNM_EE_SHEET_OPTIONAL))
{
g_free (state);
return;
}
state->name_entry = go_gtk_builder_get_widget (state->base.gui, "name_entry");
if (state->name_entry == NULL)
......
......@@ -1809,9 +1809,10 @@ static gnm_float bessel_y(gnm_float x, gnm_float alpha)
#endif
Y_bessel(&x, &alpha, &nb, by, &ncalc);
if(ncalc != nb) {/* error input */
if(ncalc == -1)
if(ncalc == -1) {
free(by);
return gnm_pinf;
else if(ncalc < -1)
} else if(ncalc < -1)
MATHLIB_WARNING4(("bessel_y(%" GNM_FORMAT_g "): ncalc (=%ld) != nb (=%ld); alpha=%" GNM_FORMAT_g ". Arg. out of range?\n"),
x, ncalc, nb, alpha);
else /* ncalc >= 0 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment