diff options
-rw-r--r-- | type_decoder.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/type_decoder.c b/type_decoder.c index a61a475..dfa3fa9 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -194,8 +194,10 @@ static int convert_binary(struct srd_decoder_inst *di, PyObject *obj, pdb->bin_class = bin_class; pdb->size = size; - if (!(pdb->data = g_try_malloc(pdb->size))) + if (!(pdb->data = g_try_malloc(pdb->size))) { + g_free(pdb); return SRD_ERR_MALLOC; + } memcpy((void *)pdb->data, (const void *)buf, pdb->size); pdata->data = pdb; |