projects
/
libsigrok.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
36165cf
)
rigol-dg: free memory that was allocated by SCPI get routines
author
Gerhard Sittig
<gerhard.sittig@gmx.net>
Sun, 16 May 2021 12:45:47 +0000
(14:45 +0200)
committer
Gerhard Sittig
<gerhard.sittig@gmx.net>
Sat, 22 May 2021 06:06:58 +0000
(08:06 +0200)
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.
src/hardware/rigol-dg/api.c
patch
|
blob
|
history
diff --git
a/src/hardware/rigol-dg/api.c
b/src/hardware/rigol-dg/api.c
index ea8189b944a4eb3085486b1fa5b7aa823a687433..e8a3aadc8acd4ea2fd8edaa2824bb114abb42f31 100644
(file)
--- a/
src/hardware/rigol-dg/api.c
+++ b/
src/hardware/rigol-dg/api.c
@@
-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;
}