Commit 21cef58b authored by Havoc Pennington's avatar Havoc Pennington

2003-04-02 Havoc Pennington <hp@redhat.com>

	* dbus/dbus-string.c (set_length): fix a bug - we allocated max of
	current alloc and needed new length, not max of the doubled
	allocation and needed new length. Also, when building tests,
	don't do the double-allocation stuff, just realloc every time.
parent 94790fef
2003-04-02 Havoc Pennington <hp@redhat.com>
* dbus/dbus-string.c (set_length): fix a bug - we allocated max of
current alloc and needed new length, not max of the doubled
allocation and needed new length. Also, when building tests,
don't do the double-allocation stuff, just realloc every time.
2003-04-02 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps.c (_dbus_file_get_contents): include filenames
......
......@@ -361,8 +361,17 @@ set_length (DBusRealString *real,
else
new_allocated = real->allocated * 2;
/* if you change the code just above here, run the tests without
* the following before you commit
*/
#ifdef DBUS_BUILD_TESTS
new_allocated = 0; /* ensure a realloc every time so that we go
* through all malloc failure codepaths
*/
#endif
/* But be sure we always alloc at least space for the new length */
new_allocated = MAX (real->allocated, new_length + ALLOCATION_PADDING);
new_allocated = MAX (new_allocated, new_length + ALLOCATION_PADDING);
new_str = dbus_realloc (real->str - real->align_offset, new_allocated);
if (new_str == NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment