more asserts

doc_update_sequoia
vb 2015-03-11 16:39:06 +01:00
parent 29c626c4ee
commit 254b93a1ba
6 changed files with 12 additions and 3 deletions

View File

@ -119,6 +119,7 @@ DYNAMIC_API message * message_dup(const message *src)
if (src->sent) {
msg->sent = malloc(sizeof(timestamp));
assert(msg->sent);
if (msg->sent == NULL)
goto enomem;
memcpy(msg->sent, src->sent, sizeof(timestamp));
@ -126,6 +127,7 @@ DYNAMIC_API message * message_dup(const message *src)
if (src->recv) {
msg->recv = malloc(sizeof(timestamp));
assert(msg->recv);
if (msg->recv == NULL)
goto enomem;
memcpy(msg->recv, src->recv, sizeof(timestamp));

View File

@ -24,6 +24,7 @@ static char * combine_short_and_long(const char *shortmsg, const char *longmsg)
longmsg = "";
ptext = calloc(1, strlen(shortmsg) + strlen(longmsg) + 12);
assert(ptext);
if (ptext == NULL)
return NULL;

View File

@ -376,7 +376,7 @@ DYNAMIC_API PEP_STATUS safewords(
)
{
const char *source = fingerprint;
char *buffer = calloc(1, MAX_SAFEWORDS_SPACE);
char *buffer;
char *dest = buffer;
size_t fsize;
PEP_STATUS _status;
@ -390,6 +390,7 @@ DYNAMIC_API PEP_STATUS safewords(
*words = NULL;
*wsize = 0;
buffer = calloc(1, MAX_SAFEWORDS_SPACE);
assert(buffer);
if (buffer == NULL)
return PEP_OUT_OF_MEMORY;

View File

@ -684,8 +684,7 @@ PEP_STATUS pgp_encrypt_and_sign(
return PEP_UNKNOWN_ERROR;
}
rcpt = calloc(stringlist_length(keylist) + 1,
sizeof(gpgme_key_t));
rcpt = calloc(stringlist_length(keylist) + 1, sizeof(gpgme_key_t));
assert(rcpt);
if (rcpt == NULL) {
gpg.gpgme_data_release(plain);

View File

@ -8,6 +8,8 @@
DYNAMIC_API stringlist_t *new_stringlist(const char *value)
{
stringlist_t *result = calloc(1, sizeof(stringlist_t));
assert(result);
if (result && value) {
result->value = strdup(value);
assert(result->value);
@ -16,6 +18,7 @@ DYNAMIC_API stringlist_t *new_stringlist(const char *value)
return NULL;
}
}
return result;
}

View File

@ -51,6 +51,8 @@ DYNAMIC_API stringpair_t * stringpair_dup(const stringpair_t *src)
DYNAMIC_API stringpair_list_t *new_stringpair_list(const stringpair_t *value)
{
stringpair_list_t *result = calloc(1, sizeof(stringpair_list_t));
assert(result);
if (result && value) {
result->value = stringpair_dup(value);
if (result->value == 0) {
@ -58,6 +60,7 @@ DYNAMIC_API stringpair_list_t *new_stringpair_list(const stringpair_t *value)
return NULL;
}
}
return result;
}