Seems that the duplicated are expected, and the crash seems related to how i access the name slot<br><br>If i change the code to remove the mem-ref form it works fine, but i don't know what is the different.<br><br>(cffi:with-foreign-object (p :pointer)                                                                                                             <br>
           (ice-cffi:getifaddrs p)                                                                                                                           <br>           (do ()                                                                                                                                            <br>
               ((cffi:null-pointer-p p))                                                                                                                     <br>             (format t "Interface: ~a~%" (cffi:foreign-slot-value p 'ifaddrs 'name))                                                                         <br>
             (setf p (cffi:foreign-slot-value p 'ifaddrs 'next))))<br><br><br><div class="gmail_quote">On Mon, Dec 13, 2010 at 10:39 PM, pepone.onrez <span dir="ltr"><<a href="mailto:pepone.onrez@gmail.com">pepone.onrez@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi,<br><br>I don't understand why my loop crashes,<br><br>Here is my grovel definition for ifaddrs struct:<br>
<br>(cstruct ifaddrs "struct ifaddrs"<br>         (next "ifa_next" :type :pointer)<br>         (name "ifa_name" :type :string)<br>
         (flags "ifa_flags" :type :unsigned-int)<br>         (address "ifa_addr" :type :pointer)<br>         (netmask "ifa_netmask" :type :pointer)<br>         (broadcast "ifa_broadaddr" :type :pointer)<br>

         (point-to-point-destination "ifa_dstaddr" :type :pointer)<br>         (data "ifa_data" :type :pointer))<br><br>Here is my loop, i was expecting next to be a null pointer after the first vmnet8<br>

<br>CL-USER>  (cffi:with-foreign-object (p :pointer)                                                                                                             <br>           (getifaddrs p)                                                                                                                           <br>

           (do ()                                                                                                                                            <br>               ((cffi:null-pointer-p p))                                                                                                                     <br>

             (format t "Interface: ~a~%" (cffi:foreign-slot-value (cffi:mem-ref p :pointer) 'ifaddrs 'name))                                                 <br>             (setf p (cffi:foreign-slot-value p 'ifaddrs 'next))))<br>

Interface: lo                                                                                                                                                <br>Interface: sit0                                                                                                                                              <br>

Interface: eth0                                                                                                                                              <br>Interface: wlan0                                                                                                                                             <br>

Interface: vmnet1                                                                                                                                            <br>Interface: vmnet8                                                                                                                                            <br>

Interface: lo                                                                                                                                                <br>Interface: wlan0                                                                                                                                             <br>

Interface: vmnet1                                                                                                                                            <br>Interface: vmnet8                                                                                                                                            <br>

Interface: lo                                                                                                                                                <br>Interface: wlan0                                                                                                                                             <br>

Interface: vmnet1                                                                                                                                            <br>Interface: vmnet8                                                                                                                                            <br>

; Evaluation aborted on #<SB-SYS:MEMORY-FAULT-ERROR {BF604E1}>.<br>        <br>Regards,<br>Jose<br>
</blockquote></div><br>