Changeset 27
- Timestamp:
- 04/29/08 15:08:04
(7 months ago)
- Author:
- jtang
- Message:
Fix possible memory leak if realloc() failed.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r21 |
r27 |
|
| 243 | 243 | alloc_sz += next_alloc_sz(*len, recv_sz, msgtxt_sz, sipc->msg_len); |
|---|
| 244 | 244 | |
|---|
| 245 | | *data = realloc(*data, alloc_sz); |
|---|
| 246 | | if (!(*data)) { |
|---|
| | 245 | char *tdata = realloc(*data, alloc_sz); |
|---|
| | 246 | if (!(*tdata)) { |
|---|
| 247 | 247 | sipc_error(sipc, "%s\n", "Out of memory"); |
|---|
| | 248 | free(*data); |
|---|
| | 249 | *data = NULL; |
|---|
| 248 | 250 | goto err; |
|---|
| 249 | 251 | } |
|---|
| | 252 | *data = tdata; |
|---|
| 250 | 253 | |
|---|
| 251 | 254 | /* memset(*data+idx, 0x0, recv_sz); */ |
|---|
Download in other formats:
* Generating other formats may take time.