|
|||||||||||
|
Re: A bug in message_add_payload()
From: Aref Taidi <ataidi(at)avaya.com>
Date: Thu Apr 17 2003 - 11:53:55 EDT
Please give me time to do more investigation so that I can give you more accurate information.
Regards,
-----Original Message-----
On Wed, 16 Apr 2003, Aref Taidi wrote: > The problem I had was that message_check_duplicate() called message_free()
This 'payload' data was allocated by the malloc() call prior to the realloc() in message_add_payload(), or in the message_index_payload() function. As far as I recall, and after a quick search through the source, there are no other places where 'struct payload' objects are allocated. The realloc() only concerned the msg->iov array, which was used and freed a few lines above these lines in message_free(), without errors. If you get an error here, I suspect the TAILQ handling is faulty somehow. Or we may need to track where memory used in that TAILQ is allocated and freed. AFAICT this looks sane, but perhaps I've missed something here. >
How did you fix this? Show me code, please. As struct iov is defined as (/usr/includes/sys/uio.h) struct iovec {
void *iov_base; /* Base address. */
size_t iov_len; /* Length. */
};
and the realloc's new size here is (iov_len + 1) * sizeof (struct iovec), and both variables of the the newly allocated iovec struct's (i.e. iov_base and iov_len) are filled in (assuming the realloc does not fail), I do not see how clearing those bytes prior to this can possibly have any effect. In fact, as far as I understand compiler optimizations (not a lot, admittedly), this zeroing would be a good candidate for an optimizer to remove from the generated code. new_iov
You're proposing to add something like memset (&new_iov[msg->iovlen], 0, sizeof *msg->iov); right next to the "msg->iov = new_iov;" line ? I'm sorry, I really do not follow you here. /H -- Håkan OlssonReceived on Thu Apr 17 11:57:26 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:54 EDT |
||||||||||
|
|||||||||||