@@ -291,6 +291,7 @@ void static inline node_alloc(node_buffer* b, int ask)
291291 if (space >= ask) return;
292292 int size2 = (b->size + 1000 + ask) * 2;
293293 node* buf2 = malloc(size2 * sizeof(node));
294+ assert(buf2);
294295 memcpy(buf2, b->nodes, b->used_front * sizeof(node));
295296 memcpy(&buf2[size2 - b->used_back], &b->nodes[b->size - b->used_back], b->used_back * sizeof(node));
296297 free(b->alloc);
@@ -305,6 +306,7 @@ void static inline attr_alloc(attr_buffer* b, int ask)
305306 if (space >= ask) return;
306307 int size2 = (b->size + 1000 + ask) * 2;
307308 attr* buf2 = malloc(size2 * sizeof(attr));
309+ assert(buf2);
308310 memcpy(buf2, b->attrs, b->used * sizeof(attr));
309311 free(b->alloc);
310312 b->size = size2;
@@ -316,6 +318,7 @@ void set_error(document* d, char* msg)
316318{
317319 if (d->error_message != NULL) return; // keep the first error message
318320 d->error_message = malloc(strlen(msg)+1);
321+ assert(d->error_message);
319322 strcpy(d->error_message, msg);
320323}
321324
@@ -511,6 +514,7 @@ document* document_parse(char* s, int slen)
511514 init_parse_table();
512515
513516 buffer* buf = malloc(sizeof(buffer));
517+ assert(buf);
514518 document* d = &buf->document;
515519 d->body = s;
516520 d->cursor = s;