Re: Foreign memory context read
От | Vaibhav Kaushal |
---|---|
Тема | Re: Foreign memory context read |
Дата | |
Msg-id | BANLkTina2ZXKh1EDHSTGQFJbqw8a-Cqbng@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Foreign memory context read (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
<p>Oh...well... I messed it up! Thanks a lot for that. The problem I think is the bool pointer. Will check it soon.<p>--<br/> Sent from my Android<div class="gmail_quote">On 23 May 2011 19:28, "Tom Lane" <<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>>wrote:<br type="attribution" />> Vaibhav Kaushal <<a href="mailto:vaibhavkaushal123@gmail.com">vaibhavkaushal123@gmail.com</a>>writes:<br /> >> My mind started wanderingafter that error. Now, actually, i was trying to<br />>> do something like this:<br />> <br />>>*last_result = palloc0(sizeof(Datum));<br />>> bool *isnnuull = true;<br />>> *last_result = slot_getattr(slot,num_atts, *isnnuull);<br /> > <br />> This seems utterly confused about data types. The first linethinks<br />> that last_result is of type Datum ** (ie, pointer to pointer to Datum),<br />> since it's storinga pointer-to-Datum through it. The third line<br /> > however is treating last_result as of type Datum *, sinceit's storing<br />> a Datum (not pointer to Datum) through it. And the second line is<br />> assigning "true"(a bool value) to a variable declared as pointer to<br /> > bool, which you then proceed to incorrectly dereferencewhile passing it<br />> as the last argument to slot_getattr. The code will certainly crash on<br />> thatderef, independently of the multiple other bugs here.<br /> > <br />> Recommendation: gcc is your friend. Pay attentionto the warnings it<br />> gives you.<br />> <br />> regards, tom lane<br /></div>
В списке pgsql-hackers по дате отправления: