The scan_2x_bd232() routine used to always prepare one spare context,
and filled it in when a device was found, just to allocate another one
and continue scanning.
Free the last allocated context unconditionally, as it was allocated
unconditionally, and never used.
This was reported by clang's scan-build.
}
};
- /* Free last alloc if no device found */
- if (devc->model == METRAHIT_NONE) {
- g_free(devc);
- sr_dev_inst_free(sdi);
- }
+ /* Free last alloc that was done in preparation. */
+ g_free(devc);
+ sr_dev_inst_free(sdi);
return std_scan_complete(di, devices);