Commit Graph

4555 Commits

Author SHA1 Message Date
Gerhard Sittig 6f63b1ee67 usb: re-use existing values, don't re-determine bus and device address
Avoid repeated libusb bus number and device address retrieval operations,
instead use variables where the information previously got stored to.
2018-02-09 21:59:18 +01:00
Gerhard Sittig 241c03029d log: flush log lines, to cope with non-terminal output (pipes)
Although log messages are terminated by a line feed, output still might
get buffered when the program does not talk to a terminal (that it is
aware of). Add an fflush(3) call to the printf(3) sequence such that log
output will immediately show up when writing to pipes or sockets, too.
2018-02-09 21:59:18 +01:00
Gerhard Sittig 928560e6f5 backend: fixup resource leak in sr_init() error code path
Early sr_init() steps can just 'return' fine. After allocation of the
'context' memory, make all error paths 'goto done' before returning,
to undo the memory allocation.
2018-02-09 21:59:18 +01:00
Gerhard Sittig 309bb27ee4 README.devices: the PRINT button must get pressed for Metrix MX56C 2018-02-09 21:59:18 +01:00
Gerhard Sittig 11e3a56380 srzip: don't access non-existing option
The srzip output module dropped support for the "filename" option in
commit 37875f7506 on 2015-07-30, but still used to assign to slot
options[0] which clobbers the array's sentinel. Remove those accesses
to the non-existing option.
2018-02-09 21:59:18 +01:00
Uwe Hermann 793e9963b8 hantek-4032l: Fix a compiler warning.
api.c: In function 'config_set':
  api.c:352:5: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'uint64_t' [-Wformat=]
       sr_err("invalid sample range 2k...64M: %ld",
       ^
2018-02-09 21:44:23 +01:00
Uwe Hermann 3347fe26a0 beaglelogic: Fix a compiler warning.
beaglelogic_tcp.c: In function 'beaglelogic_tcp_send_cmd':
 beaglelogic_tcp.c:114:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' [-Wformat=]
     sr_dbg("Only sent %d/%lu bytes of command: '%s'.", out,
     ^
2018-02-09 21:44:23 +01:00
Gerhard Sittig 93b5cd6919 yokogawa-dlm: fix several compiler warnings (assignment, memory)
Check pointers' validity before dereferencing them. Release partially
allocated memory in an error path. Remove an assignment which never took
effect.

This was reported by clang's scan-build.
2018-02-09 21:37:40 +01:00
Gerhard Sittig 2da5c95f3d tondaj-sl-814: fix a potential memory leak
Release an allocated device instance in an error path.

This was reported by clang's scan-build.
2018-02-09 21:37:40 +01:00
Gerhard Sittig aedbf89d85 sysclk-lwla: silence potential NULL dereference compiler warning
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:40 +01:00
Gerhard Sittig 08eba2d301 scpi-pps: silence potential NULL dereference compiler warning
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:40 +01:00
Gerhard Sittig 6a821db6f2 saleae-logic-pro: silence "assigned, not used" compiler warning
Remove an assignment that never took effect.

This was reported by clang's scan-build.
2018-02-09 21:37:40 +01:00
Gerhard Sittig 0306ae30b6 rigol-ds: silence potential NULL dereference compiler warning
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig b04cbd0ba3 ols, pipistrello-ols: silence "assigned, not used" compiler warning
Each code path either assigns to 'flags', or leaves the routine. There
is no potential path that leaves the variable at the initially assigned
value, so the assignment took no effect. Remove it.

Nit: Trim the source code line length while we are here.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig 8eadb70a37 norma-dmm: fix a potential memory leak
Release an allocated buffer in an error path.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig e4924d752b motech-lps-30x: fix several compiler warnings
Check pointers' validity before dereferencing them. Explicitly assign a
default value to variables, before conversion routines conditionally
assign the "real" value (and don't in case of conversion errors). This
avoids processing "garbage" data.

Strictly speaking I cannot see how the conversion routine returns OK and
has _not_ assigned a result. But the explicit assignment won't harm
either, and matches the fallback when the conversion fails (detectibly).
Which means that runtime behaviour won't change.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig fe535a89c9 maynuo-m97: fix potential NULL dereference
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig 4072d5b42f manson-hcs-3xxx: fix potential NULL dereference
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig f62c2ad65d lecroy-xstream: fix several compiler warnings (assignment, memory)
Remove an assignment that won't take effect. Check pointers' validity
before dereferencing. Fix a memory leak.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig b65adcedb8 lascar-el-usb: fix potential NULL dereference and memory leak
Check for successful allocation of multiple memory ranges, and release
partial allocations in the error path when one of them failed. This
fixes a potential memory leak, as well as avoids NULL dereferences.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig fc69eecca0 korad-kaxxxxp: fix potential NULL dereference
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig 1674225a2f hp-3457a: fix potential NULL dereference
Check the active channels' list for not being empty, before
dereferencing pointers.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig e93ca8a4d6 hantek-6xxx: fix potential NULL dereference
Check pointers' validity before dereferencing.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig b0e80e9aa9 hameg-hmo: fix several compiler warnings (assignments, memory)
Silence warnings about assigned values that never get used, potential
NULL deference, and potential memory leaks.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig 56e9672b11 gmc-mh-1x-2x: fix potential memory leak
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.
2018-02-09 21:37:39 +01:00
Gerhard Sittig 0d1c51f57f fx2lafw: silence "NULL dereference" compiler warning
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:37:39 +01:00
Gerhard Sittig f6051b9eca ftdi-la: silence "assigned but never used" compiler warning
Stick with the prepared but unfinished "limit msec" code path, but
silence the warning about an unused variable value.

This was reported by clang's scan-build.
2018-02-09 21:37:35 +01:00
Gerhard Sittig 051e4beb79 dreamsourcelab-dslogic: avoid division by zero
Do not align to block_size when its value is zero.

This was reported by clang's scan-build.
2018-02-09 21:34:17 +01:00
Gerhard Sittig 8e2fd23acb dreamsourcelab-dslogic: avoid NULL pointer dereference
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:34:17 +01:00
Gerhard Sittig 755eb22156 chronovu-la: avoid NULL pointer dereference
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:34:17 +01:00
Gerhard Sittig 05b0cc416f beaglelogic: fixup use of uninitialized data in TCP routines
Make sure that failure to communicate via TCP results in access to
uninitialized data.

This was reported by clang's scan-build.
2018-02-09 21:34:17 +01:00
Gerhard Sittig 71f2000bfb beaglelogic: fixup memory leak in the TCP command send routine
Release allocated memory in an error code path.

This was reported by clang's scan-build.
2018-02-09 21:34:17 +01:00
Gerhard Sittig f6c685e4d3 atten-pps3xxx: silence NULL dereference compiler warnings
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 21:34:17 +01:00
Gerhard Sittig 7ee8511be4 session_driver: avoid division by zero, catch API violation
Avoid a division by zero, by not using a zero unitsize in a modulo
operation. As a byproduct, avoid processing and counting input that
neither has analog nor logic data. This should never have happened,
but the change now catches the error if invalid input is seen.

This was reported by clang's scan-build.
2018-02-09 21:34:09 +01:00
Gerhard Sittig f129014ca4 session: fixup access to uninitialized memory
The sr_packet_copy() routine could have written to an arbitrary memory
location. Make sure to allocate the space before writing to it, and
check for successful allocation before accessing the memory.

It's assumed that this error never took effect, as the routine appears
to be unused.

This was reported by clang's scan-build.
2018-02-09 21:32:11 +01:00
Gerhard Sittig da6f107eff scpi: avoid uninitialized use of a variable
The 'opc' variable was only conditionally assigned to (depends on
successful SCPI communication). Ensure there always is a known value.

This was reported by clang's scan-build.
2018-02-09 21:32:11 +01:00
Gerhard Sittig d3ec7035bc output/srzip: silence "use after free" compiler warning
Defer memory g_free() until after the data gets accessed one last time.

This was reported by clang's scan-build.
2018-02-09 21:32:04 +01:00
Gerhard Sittig a21fef07b6 output/csv: silence NULL dereference compiler warnings
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
2018-02-09 20:52:26 +01:00
Gerhard Sittig 603643fa71 input/raw_analog: silence "use after free" compiler warning
The cleanup() call will void the memory which 'inc' points to. Move the
dereference before the release.

This was reported by clang's scan-build.
2018-02-08 21:47:21 +01:00
Soeren Apel d8fb599c67 lecroy-xstream: Wait for trigger before acquiring additional frames 2018-01-11 02:21:50 +01:00
Soeren Apel 724b4945d5 lecroy-xstream: Properly handle a stopping acquisition 2018-01-11 02:21:50 +01:00
Soeren Apel 2498512972 lecroy-xstream: Keep acquiring infinitely if no frame limit is set 2018-01-11 02:21:50 +01:00
Uwe Hermann d3f14af7ed hantek-dso: Capture ratio is a uint64_t.
From src/hwdriver.c:

  {SR_CONF_CAPTURE_RATIO, SR_T_UINT64, "captureratio",
          "Pre-trigger capture ratio", NULL},
2018-01-11 02:21:50 +01:00
Uwe Hermann 04069272b4 hantek-dso: config_set(): Shorten SR_CONF_CAPTURE_RATIO case.
The sr_config_set() wrapper already checks for SR_CONF_CAPTURE_RATIO
being 0..100.
2018-01-11 02:21:50 +01:00
Uwe Hermann be702d16d0 hantek-dso: Add missing SR_PRIV. 2018-01-11 02:21:50 +01:00
Uwe Hermann 6deb361bbf hantek-dso: Sample rate is a uint64_t.
Also make 'base' uint64_t, otherwise there'll be compiler warnings.
2018-01-11 02:21:50 +01:00
Uwe Hermann ab8df2b1a6 hantek-dso: Random cosmetics, drop unneeded debug output. 2018-01-11 02:21:50 +01:00
Philipp Marek 8f484ca78e hantek-dso: dso2250: Fix capture runaway, only do the requested number of frames.
After the first capture ->num_frames never got to be _equal_
to ->limit_frames; fixed by resetting to zero in dev_acquisition_stop(),
and protected against similar problems in the future by switching to
greater-or-equal instead.
2018-01-11 02:21:50 +01:00
Philipp Marek 12f62ce620 hantek-dso: dso2250: Allow setting TRIGGER_LEVEL as well. 2018-01-11 02:21:50 +01:00
Philipp Marek 16a1dca4ad hantek-dso: Fix a memory leak. 2018-01-11 02:21:50 +01:00