aboutsummaryrefslogtreecommitdiff
path: root/plugins/ublox/mm-modem-helpers-ublox.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-01-02 10:11:22 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-01-30 12:10:03 +0100
commitfec1c43f809d6bffffd8f56554807497d7be5ac0 (patch)
tree4ddc98f9a3c75e53974bd4b9a9021fb7f48526dc /plugins/ublox/mm-modem-helpers-ublox.c
parentde5b9e441f282cd33b03f0d5b69863d56e3afac6 (diff)
ublox: don't create array with totally unrelated size
Diffstat (limited to 'plugins/ublox/mm-modem-helpers-ublox.c')
-rw-r--r--plugins/ublox/mm-modem-helpers-ublox.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/plugins/ublox/mm-modem-helpers-ublox.c b/plugins/ublox/mm-modem-helpers-ublox.c
index e69053d5..442ff601 100644
--- a/plugins/ublox/mm-modem-helpers-ublox.c
+++ b/plugins/ublox/mm-modem-helpers-ublox.c
@@ -1290,8 +1290,6 @@ mm_ublox_build_ubandsel_set_command (GArray *bands,
if (bands->len == 1 && g_array_index (bands, MMModemBand, 0) == MM_MODEM_BAND_ANY)
return g_strdup ("+UBANDSEL=0");
- ubandsel_nums = g_array_sized_new (FALSE, FALSE, sizeof (guint), G_N_ELEMENTS (band_configuration));
-
for (i = 0; i < G_N_ELEMENTS (band_configuration); i++) {
if (g_str_has_prefix (model, band_configuration[i].model))
break;
@@ -1300,10 +1298,11 @@ mm_ublox_build_ubandsel_set_command (GArray *bands,
if (i == G_N_ELEMENTS (band_configuration)) {
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Unknown modem model %s", model);
- g_array_unref (ubandsel_nums);
return NULL;
}
+ ubandsel_nums = g_array_sized_new (FALSE, FALSE, sizeof (guint), bands->len);
+
for (j = 0; j < bands->len; j++) {
MMModemBand band;
gboolean found = FALSE;