diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-13 08:09:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-13 08:23:14 +0300 |
commit | 37c55527427201e86f06ec8038fd8feaae00c92e (patch) | |
tree | 6f7b633c431b324f52e3d165596f54de85b0746c /source/blender/windowmanager/intern/wm_dragdrop.c | |
parent | 5d9919988009b158cd918b402d29fc516ad47e35 (diff) |
Fix memory leak with image drag and drop
Dragging an image from the file selector into the sequencer
was leaking memory.
Regression in b5d778a7d4072bfb091198a2094890157a6d017b.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_dragdrop.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index fe2e2d92127..08f60fef0d2 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -150,6 +150,10 @@ wmDrag *WM_event_start_drag( switch (type) { case WM_DRAG_PATH: BLI_strncpy(drag->path, poin, FILE_MAX); + /* As the path is being copied, free it immediately as `drag` wont "own" the data. */ + if (flags & WM_DRAG_FREE_DATA) { + MEM_freeN(poin); + } break; case WM_DRAG_ID: if (poin) { |