The SCPI get routines may allocate memory for response data which
callers have to free after use.
Move an existing assigment such that the initial assignment, the memory
allocation, use of response data, and resource release are in closer
proximity, and thus are easier to reason about during maintenance.
Behaviour does not change.
This is motivated by bug #1683.
(void)fd;
(void)revents;
- data = NULL;
-
if (!(sdi = cb_data))
return TRUE;
*/
switch (ch->type) {
case SR_CHANNEL_ANALOG:
+ data = NULL;
if (sr_scpi_get_block(sdi->conn, NULL, &data) != SR_OK) {
if (data)
g_byte_array_free(data, TRUE);
data = NULL;
break;
case SR_CHANNEL_LOGIC:
+ data = NULL;
if (sr_scpi_get_block(sdi->conn, NULL, &data) != SR_OK) {
if (data)
g_byte_array_free(data, TRUE);