diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-03-20 08:59:30 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2017-03-20 08:59:30 +0100 |
commit | 77c8ee74ff0f0ef4462fd6e963bc993c7a9721b3 (patch) | |
tree | 8ce088505a5c2815c86a8037135f8e356eb58a00 | |
parent | 6dfb983cfc8992fc21690ced6203894f57a19686 (diff) | |
download | libgit2-77c8ee74ff0f0ef4462fd6e963bc993c7a9721b3.tar.gz |
checkout: fix double-free of checkout_data's mkdir_map
We currently call `git_strmap_free` on `checkout_data.mkdir_map` in the
`checkout_data_clear` function. The only thing protecting us from a
double-free is that the `git_strmap_free` function is in fact not a
function, but a macro that also sets the map to NULL.
Remove the second call to `git_strmap_free` and explicitly set the map
member to NULL.
-rw-r--r-- | src/checkout.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/checkout.c b/src/checkout.c index af600da6c..9d1eed59f 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -2319,8 +2319,6 @@ static void checkout_data_clear(checkout_data *data) git__free(data->pfx); data->pfx = NULL; - git_strmap_free(data->mkdir_map); - git_buf_free(&data->target_path); git_buf_free(&data->tmp); @@ -2328,6 +2326,7 @@ static void checkout_data_clear(checkout_data *data) data->index = NULL; git_strmap_free(data->mkdir_map); + data->mkdir_map = NULL; git_attr_session__free(&data->attr_session); } |