On Wed, Oct 23, 2019 at 05:53:40PM +0800, Jidong Xia wrote:
There is a memory leak in OPLCreate(),Should free allocated mem
before return.
Signed-off-by: Jidong Xia <address@hidden>
---
hw/audio/fmopl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 9f50a89..ca9825b 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -1112,6 +1112,7 @@ FM_OPL *OPLCreate(int clock, int rate)
opl_dbg_maxchip++;
}
#endif
+ free(ptr);
return OPL;
I don't know this code well, but I don't think is correct to free 'ptr' in
the success case, since it is the pointer returned by this function that
will be freed by OPLDestroy().
Does that sound right or did I miss something?