diff options
Diffstat (limited to '')
-rw-r--r-- | libcontacts_birthday_destroy.c | 2 | ||||
-rw-r--r-- | libcontacts_parse_contact.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libcontacts_birthday_destroy.c b/libcontacts_birthday_destroy.c index c2c1f95..8935b76 100644 --- a/libcontacts_birthday_destroy.c +++ b/libcontacts_birthday_destroy.c @@ -5,5 +5,5 @@ void libcontacts_birthday_destroy(struct libcontacts_birthday *this) { - (void) this; + DESTROY_ALL_STRINGS(this->unrecognised_data); } diff --git a/libcontacts_parse_contact.c b/libcontacts_parse_contact.c index 79dc579..1c2b336 100644 --- a/libcontacts_parse_contact.c +++ b/libcontacts_parse_contact.c @@ -7,6 +7,8 @@ static time_t gettime(const char *data) { time_t ret = 0; + while (*data == ' ' || *data == '\t') data++; + data = &strchr(data, ' ')[1]; if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { @@ -24,6 +26,8 @@ static unsigned int getposuint(const char *data) { unsigned int ret = 0; + while (*data == ' ' || *data == '\t') data++; + data = &strchr(data, ' ')[1]; if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { @@ -41,6 +45,8 @@ static unsigned char getposuchar(const char *data) { unsigned char ret = 0; + while (*data == ' ' || *data == '\t') data++; + data = &strchr(data, ' ')[1]; if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { @@ -419,7 +425,7 @@ libcontacts_parse_contact(char *data, struct libcontacts_contact *contact) break; } else if (!strcmp(p, "BIRTH:") && !contact->birthday) { - contact->birthday = malloc(sizeof(*contact->birthday)); + contact->birthday = calloc(1, sizeof(*contact->birthday)); if (!contact->birthday) goto fail; state = 9; |