Menu

#5 Fix CloseDevice segfault when no device is open

Unstable_(example)
open
nobody
None
5
2014-08-27
2014-08-27
No

Currently, calling CloseDevice() before any device is created leads to a segfault. The following adds a simple test to avoid that:

--- /home/jhenin/tmp/libk8055.c 2008-08-20 19:01:56.000000000 +0200
+++ libk8055.0.4.1/libk8055.c   2014-08-27 10:33:39.947338618 +0200
@@ -294,7 +294,7 @@
 {
      int rc;

-     if (CurrDev->DevNo == 0)
+     if (CurrDev == NULL || CurrDev->DevNo == 0)
      {
          if (DEBUG)
              fprintf(stderr, "Current device is not open\n" );

Discussion


Log in to post a comment.