ublox: don't create array with totally unrelated size
This commit is contained in:
@@ -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)
|
if (bands->len == 1 && g_array_index (bands, MMModemBand, 0) == MM_MODEM_BAND_ANY)
|
||||||
return g_strdup ("+UBANDSEL=0");
|
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++) {
|
for (i = 0; i < G_N_ELEMENTS (band_configuration); i++) {
|
||||||
if (g_str_has_prefix (model, band_configuration[i].model))
|
if (g_str_has_prefix (model, band_configuration[i].model))
|
||||||
break;
|
break;
|
||||||
@@ -1300,10 +1298,11 @@ mm_ublox_build_ubandsel_set_command (GArray *bands,
|
|||||||
if (i == G_N_ELEMENTS (band_configuration)) {
|
if (i == G_N_ELEMENTS (band_configuration)) {
|
||||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||||
"Unknown modem model %s", model);
|
"Unknown modem model %s", model);
|
||||||
g_array_unref (ubandsel_nums);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubandsel_nums = g_array_sized_new (FALSE, FALSE, sizeof (guint), bands->len);
|
||||||
|
|
||||||
for (j = 0; j < bands->len; j++) {
|
for (j = 0; j < bands->len; j++) {
|
||||||
MMModemBand band;
|
MMModemBand band;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
Reference in New Issue
Block a user