* [PATCH 1/3] message-waiting: check for NULL argument
@ 2011-01-21 12:44 Pekka.Pessi
2011-01-21 12:44 ` [PATCH 2/3] message-waiting: add allocation checks Pekka.Pessi
2011-01-26 22:47 ` [PATCH 1/3] message-waiting: check for NULL argument Denis Kenzior
0 siblings, 2 replies; 6+ messages in thread
From: Pekka.Pessi @ 2011-01-21 12:44 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
From: Pekka Pessi <Pekka.Pessi@nokia.com>
---
src/message-waiting.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/message-waiting.c b/src/message-waiting.c
index d8bfe34..0e376b6 100644
--- a/src/message-waiting.c
+++ b/src/message-waiting.c
@@ -926,11 +926,18 @@ static void message_waiting_unregister(struct ofono_atom *atom)
void ofono_message_waiting_register(struct ofono_message_waiting *mw)
{
- DBusConnection *conn = ofono_dbus_get_connection();
- const char *path = __ofono_atom_get_path(mw->atom);
- struct ofono_modem *modem = __ofono_atom_get_modem(mw->atom);
+ DBusConnection *conn;
+ const char *path;
+ struct ofono_modem *modem;
struct ofono_atom *sim_atom;
+ if (mw == NULL)
+ return;
+
+ conn = ofono_dbus_get_connection();
+ modem = __ofono_atom_get_modem(mw->atom);
+ path = __ofono_atom_get_path(mw->atom);
+
if (!g_dbus_register_interface(conn, path,
OFONO_MESSAGE_WAITING_INTERFACE,
message_waiting_methods,
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] message-waiting: add allocation checks
2011-01-21 12:44 [PATCH 1/3] message-waiting: check for NULL argument Pekka.Pessi
@ 2011-01-21 12:44 ` Pekka.Pessi
2011-01-21 12:44 ` [PATCH 3/3] doc: fix a kill-yank error Pekka.Pessi
2011-01-26 22:51 ` [PATCH 2/3] message-waiting: add allocation checks Denis Kenzior
2011-01-26 22:47 ` [PATCH 1/3] message-waiting: check for NULL argument Denis Kenzior
1 sibling, 2 replies; 6+ messages in thread
From: Pekka.Pessi @ 2011-01-21 12:44 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2914 bytes --]
From: Pekka Pessi <Pekka.Pessi@nokia.com>
---
src/message-waiting.c | 45 ++++++++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/src/message-waiting.c b/src/message-waiting.c
index 0e376b6..5d1126b 100644
--- a/src/message-waiting.c
+++ b/src/message-waiting.c
@@ -179,20 +179,22 @@ static DBusMessage *set_cphs_mbdn(struct ofono_message_waiting *mw,
if ((mw->ef_cphs_mbdn_length && !mw_mailbox_to_cphs_record[mailbox]) ||
mw->cphs_mbdn_not_provided == TRUE) {
- if (msg)
+ if (msg != NULL)
return __ofono_error_not_supported(msg);
return NULL;
}
if (mw->ef_cphs_mbdn_length == 0) {
- if (msg)
+ if (msg != NULL)
return __ofono_error_sim_not_ready(msg);
return NULL;
}
req = g_new0(struct mbdn_set_request, 1);
+ if (req == NULL)
+ goto error;
req->mw = mw;
req->mailbox = mailbox;
@@ -206,13 +208,17 @@ static DBusMessage *set_cphs_mbdn(struct ofono_message_waiting *mw,
sync ? cphs_mbdn_sync_cb : mbdn_set_cb,
OFONO_SIM_FILE_STRUCTURE_FIXED,
mw_mailbox_to_cphs_record[mailbox],
- efmbdn, mw->ef_cphs_mbdn_length, req) == -1) {
- g_free(req);
+ efmbdn, mw->ef_cphs_mbdn_length, req) == -1)
+ goto error;
- if (msg)
- return __ofono_error_failed(msg);
- } else
- req->msg = msg ? dbus_message_ref(msg) : NULL;
+ req->msg = msg ? dbus_message_ref(msg) : NULL;
+ return NULL;
+
+error:
+ g_free(req);
+
+ if (msg != NULL)
+ return __ofono_error_failed(msg);
return NULL;
}
@@ -292,6 +298,8 @@ static DBusMessage *set_mbdn(struct ofono_message_waiting *mw, int mailbox,
}
req = g_new0(struct mbdn_set_request, 1);
+ if (req == NULL)
+ goto error;
req->mw = mw;
req->mailbox = mailbox;
@@ -303,13 +311,17 @@ static DBusMessage *set_mbdn(struct ofono_message_waiting *mw, int mailbox,
if (ofono_sim_write(req->mw->sim, SIM_EFMBDN_FILEID, mbdn_set_cb,
OFONO_SIM_FILE_STRUCTURE_FIXED,
req->mw->efmbdn_record_id[mailbox],
- efmbdn, req->mw->efmbdn_length, req) == -1) {
- g_free(req);
+ efmbdn, req->mw->efmbdn_length, req) == -1)
+ goto error;
- if (msg)
- return __ofono_error_failed(msg);
- } else
- req->msg = msg ? dbus_message_ref(msg) : NULL;
+ req->msg = msg ? dbus_message_ref(msg) : NULL;
+ return NULL;
+
+error:
+ g_free(req);
+
+ if (msg)
+ return __ofono_error_failed(msg);
return NULL;
}
@@ -990,13 +1002,16 @@ struct ofono_message_waiting *ofono_message_waiting_create(struct ofono_modem *m
struct ofono_message_waiting *mw;
mw = g_try_new0(struct ofono_message_waiting, 1);
-
if (mw == NULL)
return NULL;
mw->atom = __ofono_modem_add_atom(modem,
OFONO_ATOM_TYPE_MESSAGE_WAITING,
mw_remove, mw);
+ if (mw->atom == NULL) {
+ g_free(mw);
+ return NULL;
+ }
return mw;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] doc: fix a kill-yank error
2011-01-21 12:44 ` [PATCH 2/3] message-waiting: add allocation checks Pekka.Pessi
@ 2011-01-21 12:44 ` Pekka.Pessi
2011-01-21 12:56 ` Marcel Holtmann
2011-01-26 22:51 ` [PATCH 2/3] message-waiting: add allocation checks Denis Kenzior
1 sibling, 1 reply; 6+ messages in thread
From: Pekka.Pessi @ 2011-01-21 12:44 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
From: Pekka Pessi <Pekka.Pessi@nokia.com>
---
doc/smartmessaging-api.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/doc/smartmessaging-api.txt b/doc/smartmessaging-api.txt
index 36065b4..637a5ef 100644
--- a/doc/smartmessaging-api.txt
+++ b/doc/smartmessaging-api.txt
@@ -50,7 +50,7 @@ Methods void ReceiveAppointment(array{byte} appointment, dict info)
void ReceiveBusinessCard(array{byte} card, dict info)
Requests the agent to process a new SMS that has
- arrived containing a vCalendar object. The info
+ arrived containing a vCard object. The info
dictionary contains 'Sender', 'LocalSentTime' and
'SentTime' properties.
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] doc: fix a kill-yank error
2011-01-21 12:44 ` [PATCH 3/3] doc: fix a kill-yank error Pekka.Pessi
@ 2011-01-21 12:56 ` Marcel Holtmann
0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2011-01-21 12:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 167 bytes --]
Hi Pekka,
> doc/smartmessaging-api.txt | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
patch has been applied. Thanks.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] message-waiting: check for NULL argument
2011-01-21 12:44 [PATCH 1/3] message-waiting: check for NULL argument Pekka.Pessi
2011-01-21 12:44 ` [PATCH 2/3] message-waiting: add allocation checks Pekka.Pessi
@ 2011-01-26 22:47 ` Denis Kenzior
1 sibling, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2011-01-26 22:47 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
Hi Pekka,
On 01/21/2011 06:44 AM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>
> ---
> src/message-waiting.c | 13 ++++++++++---
> 1 files changed, 10 insertions(+), 3 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] message-waiting: add allocation checks
2011-01-21 12:44 ` [PATCH 2/3] message-waiting: add allocation checks Pekka.Pessi
2011-01-21 12:44 ` [PATCH 3/3] doc: fix a kill-yank error Pekka.Pessi
@ 2011-01-26 22:51 ` Denis Kenzior
1 sibling, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2011-01-26 22:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3538 bytes --]
Hi Pekka,
On 01/21/2011 06:44 AM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>
> ---
> src/message-waiting.c | 45 ++++++++++++++++++++++++++++++---------------
> 1 files changed, 30 insertions(+), 15 deletions(-)
>
> diff --git a/src/message-waiting.c b/src/message-waiting.c
> index 0e376b6..5d1126b 100644
> --- a/src/message-waiting.c
> +++ b/src/message-waiting.c
> @@ -179,20 +179,22 @@ static DBusMessage *set_cphs_mbdn(struct ofono_message_waiting *mw,
>
> if ((mw->ef_cphs_mbdn_length && !mw_mailbox_to_cphs_record[mailbox]) ||
> mw->cphs_mbdn_not_provided == TRUE) {
> - if (msg)
> + if (msg != NULL)
Please send this as a separate style patch
> return __ofono_error_not_supported(msg);
>
> return NULL;
> }
>
> if (mw->ef_cphs_mbdn_length == 0) {
> - if (msg)
> + if (msg != NULL)
ditto
> return __ofono_error_sim_not_ready(msg);
>
> return NULL;
> }
>
> req = g_new0(struct mbdn_set_request, 1);
> + if (req == NULL)
> + goto error;
You don't actually need to perform a NULL check here. g_new0 will never
return a NULL. Only g_try_new0 will.
>
> req->mw = mw;
> req->mailbox = mailbox;
> @@ -206,13 +208,17 @@ static DBusMessage *set_cphs_mbdn(struct ofono_message_waiting *mw,
> sync ? cphs_mbdn_sync_cb : mbdn_set_cb,
> OFONO_SIM_FILE_STRUCTURE_FIXED,
> mw_mailbox_to_cphs_record[mailbox],
> - efmbdn, mw->ef_cphs_mbdn_length, req) == -1) {
> - g_free(req);
> + efmbdn, mw->ef_cphs_mbdn_length, req) == -1)
> + goto error;
>
> - if (msg)
> - return __ofono_error_failed(msg);
> - } else
> - req->msg = msg ? dbus_message_ref(msg) : NULL;
> + req->msg = msg ? dbus_message_ref(msg) : NULL;
> + return NULL;
> +
> +error:
> + g_free(req);
> +
> + if (msg != NULL)
> + return __ofono_error_failed(msg);
>
> return NULL;
> }
> @@ -292,6 +298,8 @@ static DBusMessage *set_mbdn(struct ofono_message_waiting *mw, int mailbox,
> }
>
> req = g_new0(struct mbdn_set_request, 1);
> + if (req == NULL)
> + goto error;
Same comment as above
>
> req->mw = mw;
> req->mailbox = mailbox;
> @@ -303,13 +311,17 @@ static DBusMessage *set_mbdn(struct ofono_message_waiting *mw, int mailbox,
> if (ofono_sim_write(req->mw->sim, SIM_EFMBDN_FILEID, mbdn_set_cb,
> OFONO_SIM_FILE_STRUCTURE_FIXED,
> req->mw->efmbdn_record_id[mailbox],
> - efmbdn, req->mw->efmbdn_length, req) == -1) {
> - g_free(req);
> + efmbdn, req->mw->efmbdn_length, req) == -1)
> + goto error;
>
> - if (msg)
> - return __ofono_error_failed(msg);
> - } else
> - req->msg = msg ? dbus_message_ref(msg) : NULL;
> + req->msg = msg ? dbus_message_ref(msg) : NULL;
> + return NULL;
> +
> +error:
> + g_free(req);
> +
> + if (msg)
> + return __ofono_error_failed(msg);
>
> return NULL;
> }
> @@ -990,13 +1002,16 @@ struct ofono_message_waiting *ofono_message_waiting_create(struct ofono_modem *m
> struct ofono_message_waiting *mw;
>
> mw = g_try_new0(struct ofono_message_waiting, 1);
> -
Please send this along with the style patch...
> if (mw == NULL)
> return NULL;
>
> mw->atom = __ofono_modem_add_atom(modem,
> OFONO_ATOM_TYPE_MESSAGE_WAITING,
> mw_remove, mw);
> + if (mw->atom == NULL) {
> + g_free(mw);
> + return NULL;
> + }
This chunk is not necessary since add_atom does not use g_try_new...
>
> return mw;
> }
Regards,
-Denis
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-01-26 22:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-21 12:44 [PATCH 1/3] message-waiting: check for NULL argument Pekka.Pessi
2011-01-21 12:44 ` [PATCH 2/3] message-waiting: add allocation checks Pekka.Pessi
2011-01-21 12:44 ` [PATCH 3/3] doc: fix a kill-yank error Pekka.Pessi
2011-01-21 12:56 ` Marcel Holtmann
2011-01-26 22:51 ` [PATCH 2/3] message-waiting: add allocation checks Denis Kenzior
2011-01-26 22:47 ` [PATCH 1/3] message-waiting: check for NULL argument Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox