[gupnp-dlna] Fix a potential crash if gupnp_dlna_value_list_new failed
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-dlna] Fix a potential crash if gupnp_dlna_value_list_new failed
- Date: Tue, 30 Jul 2013 08:01:40 +0000 (UTC)
commit c460839c00c5b2540d464f3479d3c532351c2398
Author: Ludovic Ferrandis <ludovic ferrandis intel com>
Date: Thu Jul 11 12:24:57 2013 +0200
Fix a potential crash if gupnp_dlna_value_list_new failed
https://bugzilla.gnome.org/show_bug.cgi?id=704096
libgupnp-dlna/gupnp-dlna-value-list.c | 39 ++++++++++++++++-----------------
1 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/libgupnp-dlna/gupnp-dlna-value-list.c b/libgupnp-dlna/gupnp-dlna-value-list.c
index 0582978..6c451ec 100644
--- a/libgupnp-dlna/gupnp-dlna-value-list.c
+++ b/libgupnp-dlna/gupnp-dlna-value-list.c
@@ -150,27 +150,26 @@ GUPnPDLNAValueList *
gupnp_dlna_value_list_copy (GUPnPDLNAValueList *list)
{
GUPnPDLNAValueList *dup;
+ GList *iter;
- if (list) {
- GList *iter;
+ g_return_val_if_fail (list != NULL, NULL);
- dup = gupnp_dlna_value_list_new (list->type);
- for (iter = list->values; iter != NULL; iter = iter->next) {
- GUPnPDLNAValue *base = (GUPnPDLNAValue *) iter->data;
- GUPnPDLNAValue *copy;
+ dup = gupnp_dlna_value_list_new (list->type);
- if (base == NULL)
- continue;
+ g_return_val_if_fail (dup != NULL, NULL);
- copy = gupnp_dlna_value_copy (base, list->type);
- if (copy != NULL)
- dup->values = g_list_prepend (dup->values,
- copy);
- }
- dup->values = g_list_reverse (dup->values);
- } else {
- dup = NULL;
- }
+ for (iter = list->values; iter != NULL; iter = iter->next) {
+ GUPnPDLNAValue *base = (GUPnPDLNAValue *) iter->data;
+ GUPnPDLNAValue *copy;
+
+ if (base == NULL)
+ continue;
+
+ copy = gupnp_dlna_value_copy (base, list->type);
+ if (copy != NULL)
+ dup->values = g_list_prepend (dup->values, copy);
+ }
+ dup->values = g_list_reverse (dup->values);
return dup;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]