[MM] [PATCH] iface-modem-messaging: check if supported storage is allocated before use
- From: Ben Chan <benchan chromium org>
- To: networkmanager-list gnome org
- Subject: [MM] [PATCH] iface-modem-messaging: check if supported storage is allocated before use
- Date: Mon, 16 Jul 2012 22:23:55 -0700
load_supported_storages may fail, which results in unallocated storage
memory. This patch modifies load_initial_sms_parts_from_storages and
is_storage_supported to handle that gracefully.
---
src/mm-iface-modem-messaging.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c
index 1ab1c13..b294af9 100644
--- a/src/mm-iface-modem-messaging.c
+++ b/src/mm-iface-modem-messaging.c
@@ -377,9 +377,11 @@ is_storage_supported (GArray *supported,
if (preferred == MM_SMS_STORAGE_UNKNOWN)
return TRUE;
- for (i = 0; i < supported->len; i++) {
- if (preferred == g_array_index (supported, MMSmsStorage, i))
- return TRUE;
+ if (supported) {
+ for (i = 0; i < supported->len; i++) {
+ if (preferred == g_array_index (supported, MMSmsStorage, i))
+ return TRUE;
+ }
}
g_set_error (error,
@@ -761,7 +763,7 @@ load_initial_sms_parts_from_storages (EnablingContext *ctx)
storage_ctx = get_storage_context (ctx->self);
- if (ctx->mem1_storage_index >= storage_ctx->supported_mem1->len)
+ if (!storage_ctx->supported_mem1 || ctx->mem1_storage_index >= storage_ctx->supported_mem1->len)
all_loaded = TRUE;
/* We'll skip the 'MT' storage, as that is a combination of 'SM' and 'ME' */
else if (g_array_index (storage_ctx->supported_mem1,
--
1.7.7.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]