summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libical/icalcomponent.c4
-rw-r--r--src/libicalss/icalgauge.c8
-rw-r--r--src/libicalss/icalspanlist.c17
-rw-r--r--src/libicalvcal/vcc.c2
-rw-r--r--src/test/regression-storage.c4
-rw-r--r--src/test/stow.c11
6 files changed, 35 insertions, 11 deletions
diff --git a/src/libical/icalcomponent.c b/src/libical/icalcomponent.c
index 73fcca84..b72e80f8 100644
--- a/src/libical/icalcomponent.c
+++ b/src/libical/icalcomponent.c
@@ -1014,6 +1014,8 @@ int icalcomponent_count_errors(icalcomponent *component)
icalcomponent *c;
pvl_elem itr;
+ icalerror_check_arg_rz((component != 0), "component");
+
for (itr = pvl_head(component->properties); itr != 0; itr = pvl_next(itr)) {
p = (icalproperty *) pvl_data(itr);
@@ -1037,6 +1039,8 @@ void icalcomponent_strip_errors(icalcomponent *component)
icalcomponent *c;
pvl_elem itr, next_itr;
+ icalerror_check_arg_rv((component != 0), "component");
+
for (itr = pvl_head(component->properties); itr != 0; itr = next_itr) {
p = (icalproperty *) pvl_data(itr);
next_itr = pvl_next(itr);
diff --git a/src/libicalss/icalgauge.c b/src/libicalss/icalgauge.c
index bbc01e81..e62a77a3 100644
--- a/src/libicalss/icalgauge.c
+++ b/src/libicalss/icalgauge.c
@@ -308,7 +308,7 @@ int icalgauge_compare(icalgauge *gauge, icalcomponent *comp)
icalproperty *prop;
icalvalue_kind vk;
- if (w->prop == ICAL_NO_PROPERTY || w->value == 0) {
+ if (!w || w->prop == ICAL_NO_PROPERTY || w->value == 0) {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
return 0;
}
@@ -436,6 +436,9 @@ void icalgauge_dump(icalgauge *gauge)
for (p = pvl_head(gauge->select); p != 0; p = pvl_next(p)) {
struct icalgauge_where *w = pvl_data(p);
+ if (!w)
+ continue;
+
if (w->comp != ICAL_NO_COMPONENT) {
printf("%s ", icalenum_component_kind_to_string(w->comp));
}
@@ -466,6 +469,9 @@ void icalgauge_dump(icalgauge *gauge)
for (p = pvl_head(gauge->where); p != 0; p = pvl_next(p)) {
struct icalgauge_where *w = pvl_data(p);
+ if (!w)
+ continue;
+
if (w->logic != ICALGAUGELOGIC_NONE) {
printf("%d ", w->logic);
}
diff --git a/src/libicalss/icalspanlist.c b/src/libicalss/icalspanlist.c
index cb30b76a..f1832c20 100644
--- a/src/libicalss/icalspanlist.c
+++ b/src/libicalss/icalspanlist.c
@@ -152,6 +152,9 @@ icalspanlist *icalspanlist_new(icalset *set, struct icaltimetype start, struct i
for (itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
struct icaltime_span *s = (struct icaltime_span *)pvl_data(itr);
+ if (!s)
+ continue;
+
if ((freetime = (struct icaltime_span *)malloc(sizeof(struct icaltime_span))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
icalspanlist_free(sl);
@@ -234,9 +237,10 @@ void icalspanlist_dump(icalspanlist *sl)
for (itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
struct icaltime_span *s = (struct icaltime_span *)pvl_data(itr);
-
- printf("#%02d %d start: %s", ++i, s->is_busy, ctime(&s->start));
- printf(" end : %s", ctime(&s->end));
+ if (s) {
+ printf("#%02d %d start: %s", ++i, s->is_busy, ctime(&s->start));
+ printf(" end : %s", ctime(&s->end));
+ }
}
}
@@ -292,6 +296,9 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist *sl, struct icalt
for (itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
s = (struct icaltime_span *)pvl_data(itr);
+ if (!s)
+ continue;
+
if (s->is_busy == 0 && s->start >= rangett && (rangett < s->end || s->end == s->start)) {
if (rangett < s->start) {
@@ -379,7 +386,7 @@ int *icalspanlist_as_freebusy_matrix(icalspanlist *sl, int delta_t)
for (itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
struct icaltime_span *s = (struct icaltime_span *)pvl_data(itr);
- if (s->is_busy == 1) {
+ if (s && s->is_busy == 1) {
time_t offset_start = s->start / delta_t - sl_start / delta_t;
time_t offset_end = (s->end - 1) / delta_t - sl_start / delta_t + 1;
time_t i;
@@ -444,7 +451,7 @@ icalcomponent *icalspanlist_as_vfreebusy(icalspanlist *sl,
struct icalperiodtype period;
struct icaltime_span *s = (struct icaltime_span *)pvl_data(itr);
- if (s->is_busy == 1) {
+ if (s && s->is_busy == 1) {
period.start = icaltime_from_timet_with_zone(s->start, 0, utc_zone);
period.end = icaltime_from_timet_with_zone(s->end, 0, utc_zone);
diff --git a/src/libicalvcal/vcc.c b/src/libicalvcal/vcc.c
index de14f411..f04321fe 100644
--- a/src/libicalvcal/vcc.c
+++ b/src/libicalvcal/vcc.c
@@ -944,7 +944,7 @@ static char * lexGetDataFromBase64()
}
}
} /* while */
- DBG_(("db: bytesLen = %lu\n", bytesLen));
+ DBG_(("db: bytesLen = %l\n", bytesLen));
/* kludge: all this won't be necessary if we have tree form
representation */
if (bytes) {
diff --git a/src/test/regression-storage.c b/src/test/regression-storage.c
index 2d67366b..add24b2d 100644
--- a/src/test/regression-storage.c
+++ b/src/test/regression-storage.c
@@ -579,8 +579,10 @@ struct calendar *unpack_calendar(char *str, size_t size)
/* vcalendar_size */
memcpy(&cal->vcalendar_size, str + cal->vcalendar_size_offset, sizeof(cal->vcalendar_size));
- if ((cal->vcalendar = (char *)malloc(sizeof(char) * cal->vcalendar_size)) == NULL)
+ if ((cal->vcalendar = (char *)malloc(sizeof(char) * cal->vcalendar_size)) == NULL) {
+ free(cal);
return 0;
+ }
/* vcalendar */
memcpy(cal->vcalendar, (char *)(str + cal->vcalendar_offset), cal->vcalendar_size);
diff --git a/src/test/stow.c b/src/test/stow.c
index 7eb57f3e..55296f23 100644
--- a/src/test/stow.c
+++ b/src/test/stow.c
@@ -106,11 +106,16 @@ enum file_type test_file(char *path)
char *lowercase(const char *str)
{
+ char *new;
char *p = 0;
- char *new = strdup(str);
- if (str == 0) {
- return 0;
+ if (!str)
+ return NULL;
+
+ new = strdup(str);
+
+ if (!new) {
+ return NULL;
}
for (p = new; *p != 0; p++) {