Skip to content

Commit f42aae2

Browse files
gscuiSasha Levin
authored andcommitted
media: platform: allegro-dvt: Fix possible memory leak in allocate_buffers_internal()
commit 0f51406 upstream. The buffer in the loop should be released under the exception path, otherwise there may be a memory leak here. To mitigate this, free the buffer when allegro_alloc_buffer fails. Fixes: f20387d ("media: allegro: add Allegro DVT video IP core driver") Cc: <[email protected]> Signed-off-by: Gaosheng Cui <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e5fe36e commit f42aae2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/media/platform/allegro-dvt/allegro-core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,10 @@ static int allocate_buffers_internal(struct allegro_channel *channel,
15101510
INIT_LIST_HEAD(&buffer->head);
15111511

15121512
err = allegro_alloc_buffer(dev, buffer, size);
1513-
if (err)
1513+
if (err) {
1514+
kfree(buffer);
15141515
goto err;
1516+
}
15151517
list_add(&buffer->head, list);
15161518
}
15171519

0 commit comments

Comments
 (0)