<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 204: Segfault when using callbacks</title><link>https://sourceforge.net/p/raspberry-gpio-python/tickets/204/</link><description>Recent changes to 204: Segfault when using callbacks</description><atom:link href="https://sourceforge.net/p/raspberry-gpio-python/tickets/204/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 18 Apr 2022 18:05:03 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/raspberry-gpio-python/tickets/204/feed.rss" rel="self" type="application/rss+xml"/><item><title>Segfault when using callbacks</title><link>https://sourceforge.net/p/raspberry-gpio-python/tickets/204/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;The following causes a use-after-free bug:&lt;br/&gt;
RPi.GPIO.add_event_detect (channel, edge, callback = RPi.GPIO.remove_event_detect)&lt;/p&gt;
&lt;p&gt;Look at the function run_py_callbacks starting at line 586 of source/py_gpio.c In the example given above, calling the callback in line 597 causes the memory pointed to by cb to be freed. If it is overwritten before line 605 (cb = cb-&amp;gt;next), then cb goes into hyperspace and a segfault follows.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Barney Stratford</dc:creator><pubDate>Mon, 18 Apr 2022 18:05:03 -0000</pubDate><guid>https://sourceforge.net9e76f9d8c837a3a75e479c543c5ff25a0eb029a0</guid></item></channel></rss>