diff options
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/commands.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/jtag/commands.c b/src/jtag/commands.c index 2997d047..5e06840a 100644 --- a/src/jtag/commands.c +++ b/src/jtag/commands.c @@ -109,7 +109,9 @@ void *cmd_queue_alloc(size_t size) if (!*p_page) { *p_page = malloc(sizeof(struct cmd_queue_page)); (*p_page)->used = 0; - (*p_page)->address = malloc(CMD_QUEUE_PAGE_SIZE); + size_t alloc_size = (size < CMD_QUEUE_PAGE_SIZE) ? + CMD_QUEUE_PAGE_SIZE : size; + (*p_page)->address = malloc(alloc_size); (*p_page)->next = NULL; } |