Changeset 78d7296483e39a19218cf1e50f7c4b4aaf0a27aa

Show
Ignore:
Timestamp:
04/10/08 18:38:42 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1207852722 +0000
git-parent:

[af918191e4b6f22a8b9b3a3d3b6f02288031e306]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1207852722 +0000
Message:

check for failed memory allocations in the reader

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stratcon_jlog_streamer.c

    r0c17b8a r78d7296  
    150150    if(ctx->buffer) free(ctx->buffer); \ 
    151151    ctx->buffer = malloc(size + 1); \ 
     152    if(ctx->buffer == NULL) { \ 
     153      noitL(noit_error, "malloc(%lu) failed.\n", size + 1); \ 
     154      goto socket_error; \ 
     155    } \ 
    152156    ctx->buffer[size] = '\0'; \ 
    153157  } \ 
     
    160164  ctx->bytes_expected = 0; \ 
    161165  if(len != size) { \ 
    162     noitL(noit_error, "SSL short read (%d/%d).  Reseting connection.\n", \ 
     166    noitL(noit_error, "SSL short read (%d/%lu).  Reseting connection.\n", \ 
    163167          len, size); \ 
    164168    goto socket_error; \ 
     
    208212 
    209213      case WANT_BODY: 
    210         FULLREAD(e, ctx, ctx->header.message_len); 
     214        FULLREAD(e, ctx, (unsigned long)ctx->header.message_len); 
    211215        stratcon_datastore_push(DS_OP_INSERT, &ctx->r.remote, ctx->buffer); 
    212216        /* Don't free the buffer, it's used by the datastore process. */