summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2018-05-16 01:27:30 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2018-05-16 12:17:42 +0200
commit8ad9a3e48ddf79e08cd48073c953ea665c464005 (patch)
tree3d034af1b073528a7192c1073685dd4c9211c466
parent48518538aef9dc7ceb2c603319a26ff8750f361e (diff)
downloadlibsigrokdecode-8ad9a3e48ddf79e08cd48073c953ea665c464005.tar.gz
libsigrokdecode-8ad9a3e48ddf79e08cd48073c953ea665c464005.zip
type_decoder.c: Fix a memory leak reported by scan-build.
type_decoder.c:206:2: warning: Potential leak of memory pointed to by 'pdb' PyGILState_Release(gstate); ^~~~~~~~~~~~~~~~~~
-rw-r--r--type_decoder.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/type_decoder.c b/type_decoder.c
index dfa3fa9..35187a5 100644
--- a/type_decoder.c
+++ b/type_decoder.c
@@ -186,12 +186,12 @@ static int convert_binary(struct srd_decoder_inst *di, PyObject *obj,
goto err;
}
- pdb = g_malloc(sizeof(struct srd_proto_data_binary));
if (PyBytes_AsStringAndSize(py_tmp, &buf, &size) == -1)
goto err;
PyGILState_Release(gstate);
+ pdb = g_malloc(sizeof(struct srd_proto_data_binary));
pdb->bin_class = bin_class;
pdb->size = size;
if (!(pdb->data = g_try_malloc(pdb->size))) {