Changeset 78d7296483e39a19218cf1e50f7c4b4aaf0a27aa
- Timestamp:
- 04/10/08 18:38:42
(5 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
| r0c17b8a |
r78d7296 |
|
| 150 | 150 | if(ctx->buffer) free(ctx->buffer); \ |
|---|
| 151 | 151 | 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 | } \ |
|---|
| 152 | 156 | ctx->buffer[size] = '\0'; \ |
|---|
| 153 | 157 | } \ |
|---|
| … | … | |
| 160 | 164 | ctx->bytes_expected = 0; \ |
|---|
| 161 | 165 | 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", \ |
|---|
| 163 | 167 | len, size); \ |
|---|
| 164 | 168 | goto socket_error; \ |
|---|
| … | … | |
| 208 | 212 | |
|---|
| 209 | 213 | case WANT_BODY: |
|---|
| 210 | | FULLREAD(e, ctx, ctx->header.message_len); |
|---|
| | 214 | FULLREAD(e, ctx, (unsigned long)ctx->header.message_len); |
|---|
| 211 | 215 | stratcon_datastore_push(DS_OP_INSERT, &ctx->r.remote, ctx->buffer); |
|---|
| 212 | 216 | /* Don't free the buffer, it's used by the datastore process. */ |
|---|