parse_probestring: Fix memory leak on error.
[sigrok-cli.git] / anykey.c
index 70e2248a0df20e72a4b0047f17e1aaf7ed2f93e4..f11b0d7b031a4a3f94deefad037c861f828cdfc7 100644 (file)
--- a/anykey.c
+++ b/anykey.c
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include <stdio.h>
 #ifdef _WIN32
 #include <windows.h>
@@ -26,8 +27,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#include "sigrok-cli.h"
 
 #ifdef _WIN32
 static HANDLE stdin_handle;
@@ -42,6 +41,7 @@ static int received_anykey(int fd, int revents, void *cb_data)
        (void)revents;
        (void)cb_data;
 
+       sr_session_source_remove(STDIN_FILENO);
        sr_session_stop();
 
        return TRUE;