1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-14 00:11:28 +05:30

Fix a double free in the List functions

The code was set up so that it would free the individual items and the data
in `freeListData`, but there was already a Go `defer` to free the data item,
resulting in a double free.

Remove the `free` in `freeListData` and leave the original one.

In addition, move the `defer` for freeing the list data before the error
check, so that the data is also free in the error case. This just removes
a minor leak.

This vulnerability was discovered by:
Jasiel Spelman of Trend Micro Zero Day Initiative and Trend Micro Team Nebula

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack
2019-07-01 14:37:24 +01:00
parent 680ca48e6d
commit 87c80bfba5
4 changed files with 4 additions and 7 deletions
-1
View File
@@ -158,5 +158,4 @@ void freeListData(char *** data, unsigned int length) {
for(i=0; i<length; i++) {
free((*data)[i]);
}
free(*data);
}