rigol-dg: free memory that was allocated by SCPI get routines

The SCPI get routines may allocate memory for response data which
callers have to free after use.

Move an existing release call to an earlier location, to avoid leaking
memory when an error path is taken.

This addresses part of bug #1683.
This commit is contained in:
Gerhard Sittig 2021-05-16 14:45:47 +02:00
parent 36165cf0f7
commit ff85a7f0ab
1 changed files with 1 additions and 2 deletions

View File

@ -780,6 +780,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
devc->counter_enabled = TRUE;
else
devc->counter_enabled = FALSE;
g_free(response);
if (!devc->counter_enabled) {
/*
@ -834,8 +835,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
}
}
g_free(response);
return ret;
}