1.1 --- a/src/message_api.c Mon Feb 22 14:38:30 2016 +0100
1.2 +++ b/src/message_api.c Mon Feb 22 14:48:29 2016 +0100
1.3 @@ -111,6 +111,7 @@
1.4
1.5 if (line_end == NULL) {
1.6 _shortmsg = strdup(src + 9);
1.7 + assert(_shortmsg);
1.8 if (_shortmsg == NULL)
1.9 goto enomem;
1.10 // _longmsg = NULL;
1.11 @@ -122,7 +123,7 @@
1.12 _shortmsg = strndup(src + 9, n - 10);
1.13 else
1.14 _shortmsg = strndup(src + 9, n - 9);
1.15 -
1.16 + assert(_shortmsg);
1.17 if (_shortmsg == NULL)
1.18 goto enomem;
1.19
1.20 @@ -131,6 +132,7 @@
1.21
1.22 if (*(src + n)) {
1.23 _longmsg = strdup(src + n);
1.24 + assert(_longmsg);
1.25 if (_longmsg == NULL)
1.26 goto enomem;
1.27 }
1.28 @@ -138,9 +140,11 @@
1.29 }
1.30 else {
1.31 _shortmsg = strdup("");
1.32 + assert(_shortmsg);
1.33 if (_shortmsg == NULL)
1.34 goto enomem;
1.35 _longmsg = strdup(src);
1.36 + assert(_longmsg);
1.37 if (_longmsg == NULL)
1.38 goto enomem;
1.39 }
1.40 @@ -307,6 +311,7 @@
1.41 if (src->shortmsg && strcmp(src->shortmsg, "pEp") != 0) {
1.42 if (session->unencrypted_subject) {
1.43 dst->shortmsg = strdup(src->shortmsg);
1.44 + assert(dst->shortmsg);
1.45 if (dst->shortmsg == NULL)
1.46 goto enomem;
1.47 ptext = src->longmsg;
1.48 @@ -352,10 +357,12 @@
1.49
1.50 dst->longmsg = strdup("this message was encrypted with p≡p "
1.51 "http://pEp-project.org");
1.52 + assert(dst->longmsg);
1.53 if (dst->longmsg == NULL)
1.54 goto enomem;
1.55
1.56 char *v = strdup("Version: 1");
1.57 + assert(v);
1.58 if (v == NULL)
1.59 goto enomem;
1.60
1.61 @@ -408,6 +415,7 @@
1.62 if (src->shortmsg && src->shortmsg[0] && strcmp(src->shortmsg, "pEp") != 0) {
1.63 if (session->unencrypted_subject) {
1.64 dst->shortmsg = strdup(src->shortmsg);
1.65 + assert(dst->shortmsg);
1.66 if (dst->shortmsg == NULL)
1.67 goto enomem;
1.68 ptext = src->longmsg;
1.69 @@ -450,6 +458,7 @@
1.70 }
1.71 else {
1.72 dst->longmsg = strdup("");
1.73 + assert(dst->longmsg);
1.74 if (dst->longmsg == NULL)
1.75 goto enomem;
1.76 }
1.77 @@ -697,7 +706,9 @@
1.78 if (ext == NULL)
1.79 return NULL;
1.80
1.81 - return strndup(filename, ext - filename);
1.82 + char *result = strndup(filename, ext - filename);
1.83 + assert(result);
1.84 + return result;
1.85 }
1.86
1.87 static PEP_color decrypt_color(PEP_STATUS status)
1.88 @@ -1007,8 +1018,10 @@
1.89
1.90 free_stringlist(keys);
1.91
1.92 - if (msg && msg->shortmsg == NULL)
1.93 + if (msg && msg->shortmsg == NULL) {
1.94 msg->shortmsg = strdup("pEp");
1.95 + assert(msg->shortmsg);
1.96 + }
1.97
1.98 if (msg)
1.99 decorate_message(msg, PEP_rating_undefined, NULL);
1.100 @@ -1098,6 +1111,7 @@
1.101 goto enomem;
1.102
1.103 msg->longmsg = strdup(ptext);
1.104 + assert(msg->longmsg);
1.105 if (msg->longmsg == NULL)
1.106 goto enomem;
1.107
1.108 @@ -1124,6 +1138,7 @@
1.109 if (ptext) {
1.110 if (is_encrypted_html_attachment(_s)) {
1.111 msg->longmsg_formatted = strdup(ptext);
1.112 + assert(msg->longmsg_formatted);
1.113 if (msg->longmsg_formatted == NULL)
1.114 goto pep_error;
1.115 }
1.116 @@ -1204,6 +1219,7 @@
1.117 }
1.118 else {
1.119 msg->shortmsg = strdup(src->shortmsg);
1.120 + assert(msg->shortmsg);
1.121 if (msg->shortmsg == NULL)
1.122 goto enomem;
1.123 }