ObjFW  Check-in [28fe0a104d]

Overview
Comment:OFStream: Free the right variable

This was forgotten when adding the caching optimizations: It still tried
to free _readBuffer instead of _readBufferMemory, which failed as the
sanity checks noticed that _readBuffer is not the pointer that had been
allocated.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 28fe0a104df9edd416f0f8ce81f4037d8e6d85dc94dbd5060737b3059c5fb452
User & Date: js on 2016-05-28 19:42:05
Other Links: manifest | tags
Context
2016-05-28
23:02
Add support for zeroing weak references check-in: 03e6d6db98 user: js tags: trunk
19:42
OFStream: Free the right variable check-in: 28fe0a104d user: js tags: trunk
15:26
OFTCPSocket+SOCKS5.m: Small type fixes check-in: c5e3f0094c user: js tags: trunk
Changes

Modified src/OFStream.m from [3e396d5660] to [b4ba3031a1].

1527
1528
1529
1530
1531
1532
1533
1534

1535
1536
1537
1538
1539
1540
1541
1542
1543
1527
1528
1529
1530
1531
1532
1533

1534
1535
1536
1537
1538
1539
1540
1541
1542
1543







-
+









	if (length > SIZE_MAX - _readBufferLength)
		@throw [OFOutOfRangeException exception];

	readBuffer = [self allocMemoryWithSize: _readBufferLength + length];
	memcpy(readBuffer, buffer, length);
	memcpy(readBuffer + length, _readBuffer, _readBufferLength);

	[self freeMemory: _readBuffer];
	[self freeMemory: _readBufferMemory];
	_readBuffer = _readBufferMemory = readBuffer;
	_readBufferLength += length;
}

- (void)close
{
	OF_UNRECOGNIZED_SELECTOR
}
@end