summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2019-04-25 12:55:59 +0200
committerAllen Winter <allen.winter@kdab.com>2019-04-26 12:38:15 -0400
commit5dd631e37c4378da07d7de6678921bc0522b15c8 (patch)
tree7db38e7619a31653c833cd798ca2cd1a367fd897
parentfb37cf19e9600edc35e51903ece2a789c692ad17 (diff)
downloadlibical-git-5dd631e37c4378da07d7de6678921bc0522b15c8.tar.gz
Address some issues reported by static analyzers (Coverity Scan, clang)
Error: REVERSE_INULL: src/libical-glib/i-cal-object.c:355: deref_ptr: Directly dereferencing pointer "iobject". src/libical-glib/i-cal-object.c:365: check_after_deref: Null-checking "iobject" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 363| 364| if (is_global_memory) { 365|-> if (iobject) { 366| GlobalData *gd; 367| ------------------------------------------------------------------ Error: ALLOC_FREE_MISMATCH: src/libical/vcomponent_cxx.cpp:922: alloc: Allocation of memory which must be freed using "operator delete". src/libical/vcomponent_cxx.cpp:922: assign: Assigning: "related_param" = "trigger_prop->get_first_parameter(icalparameter_kind const(ICAL_RELATED_PARAMETER))". src/libical/vcomponent_cxx.cpp:979: free: Calling "free" frees "related_param" using "free" but it should have been freed using "operator delete". 977| 978| if (related_param != NULL) { 979|-> free(related_param); 980| } 981| ------------------------------------------------------------------ Error: IDENTIFIER_TYPO: libical-3.0.5/src/python/Component.py:796: identifier_typo: Using "properites" appears to be a typo: * Identifier "properites" is only known to be referenced here, or in copies of this code. * Identifier "properties" is referenced elsewhere at least 18 times. src/python/Component.py:796: remediation: Should identifier "properites" be replaced by "properties"? src/python/Component.py:138: identifier_use: Example 2: Using identifier "properties". src/python/Component.py:674: identifier_use: Example 3: Using identifier "properties". src/python/test.py:274: identifier_use: Example 4: Using identifier "properties" (9 total uses in this function). src/python/test.py:393: identifier_use: Example 5: Using identifier "properties". 794| def duration(self, value=None): 795| if value != None: 796|-> due = self.properites('DUE') 797| for d in due: 798| self.remove_property(d) # Clear DUE properties Signed-off-by: Allen Winter <allen.winter@kdab.com>
-rw-r--r--src/libical-glib/i-cal-object.c.in24
-rw-r--r--src/libical/vcomponent_cxx.cpp2
-rw-r--r--src/python/Component.py4
3 files changed, 14 insertions, 16 deletions
diff --git a/src/libical-glib/i-cal-object.c.in b/src/libical-glib/i-cal-object.c.in
index a8e347f8..6998efec 100644
--- a/src/libical-glib/i-cal-object.c.in
+++ b/src/libical-glib/i-cal-object.c.in
@@ -362,24 +362,22 @@ i_cal_object_construct(GType object_type,
/* UNLOCK_PROPS (iobject); */
if (is_global_memory) {
- if (iobject) {
- GlobalData *gd;
+ GlobalData *gd;
- gd = g_new0(GlobalData, 1);
- gd->object_type = object_type;
- gd->native = native;
+ gd = g_new0(GlobalData, 1);
+ gd->object_type = object_type;
+ gd->native = native;
- g_object_weak_ref(G_OBJECT(iobject), global_data_object_freed_cb, gd);
+ g_object_weak_ref(G_OBJECT(iobject), global_data_object_freed_cb, gd);
- if (!global_objects) {
- global_objects =
- g_hash_table_new_full(global_data_hash, global_data_equal,
- g_free, g_object_unref);
- }
-
- g_hash_table_insert(global_objects, gd, iobject);
+ if (!global_objects) {
+ global_objects =
+ g_hash_table_new_full(global_data_hash, global_data_equal,
+ g_free, g_object_unref);
}
+ g_hash_table_insert(global_objects, gd, iobject);
+
G_UNLOCK(global_objects);
}
diff --git a/src/libical/vcomponent_cxx.cpp b/src/libical/vcomponent_cxx.cpp
index ed34ecab..57f1f8c7 100644
--- a/src/libical/vcomponent_cxx.cpp
+++ b/src/libical/vcomponent_cxx.cpp
@@ -976,7 +976,7 @@ icalrequeststatus VAlarm::getTriggerTime(VComponent &c, struct icaltriggertype *
}
if (related_param != NULL) {
- free(related_param);
+ delete related_param;
}
// malformed? encapsulating VEVENT or VTODO MUST have DTSTART/DTEND
diff --git a/src/python/Component.py b/src/python/Component.py
index 447132c2..783cb583 100644
--- a/src/python/Component.py
+++ b/src/python/Component.py
@@ -615,7 +615,7 @@ class GenericComponent(Component):
Examples:
# Set using string[s]
categories(('APPOINTMENT', 'EDUCATION'))
- # Returns a list of Category properites
+ # Returns a list of Category properties
categories()
When setting the attendees, any previous category Properties in the
@@ -793,7 +793,7 @@ class Todo(GenericComponent):
def duration(self, value=None):
if value != None:
- due = self.properites('DUE')
+ due = self.properties('DUE')
for d in due:
self.remove_property(d) # Clear DUE properties
return self._singular_property("DURATION", "DURATION", value, Duration)