Note that there are some explanatory texts on larger screens.

plurals
  1. POFingerprint calls cause segfaults in c++
    primarykey
    data
    text
    <p>I'm trying to write a simple fingerprint scanning program in c++ using libfprint, however it intermittently segfaults when run. Valgrind says the error is in the call to fp_enroll_finger which is consistent with my debugging, however beyond that I have absolutely no idea what is causing this error. Some of the times the program is run its fine, but some times it seems to consistently segfault for a period of time whenever the program is run? Heres the code:</p> <pre><code>#include &lt;iostream&gt; extern "C" { #include &lt;libfprint/fprint.h&gt; } using namespace std; fp_dev * fpdev; fp_print_data ** fpdata; bool createDevice(); int main(int argc, char **argv) { int r = fp_init(); if(r != 0) { return r; } while(createDevice()) { cout &lt;&lt; "Scan right index finger" &lt;&lt; endl; int enrollStatus = fp_enroll_finger(fpdev, fpdata); if(enrollStatus != 1) { cout &lt;&lt; "Bad scan" &lt;&lt; endl; fp_dev_close(fpdev); } else { cout &lt;&lt; "Good scan" &lt;&lt; endl; fp_print_data_save(fpdata[0], RIGHT_INDEX); break; } } if(fpdev != NULL) { fp_dev_close(fpdev); } fp_exit(); return 0; } bool createDevice() { fp_dscv_dev ** listOfDiscoveredDevs; fp_dscv_dev * discoveredDevice; listOfDiscoveredDevs = fp_discover_devs(); discoveredDevice = listOfDiscoveredDevs[0]; if(discoveredDevice != NULL) { cout &lt;&lt; "Device found" &lt;&lt; endl; fpdev = fp_dev_open(discoveredDevice); } else { cout &lt;&lt; "No device found" &lt;&lt; endl; return false; } fp_dscv_devs_free(listOfDiscoveredDevs); return true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload