Skip to content

Commit 77c8ee7

Browse files
committed
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.
1 parent 6dfb983 commit 77c8ee7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/checkout.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,15 +2319,14 @@ static void checkout_data_clear(checkout_data *data)
23192319
git__free(data->pfx);
23202320
data->pfx = NULL;
23212321

2322-
git_strmap_free(data->mkdir_map);
2323-
23242322
git_buf_free(&data->target_path);
23252323
git_buf_free(&data->tmp);
23262324

23272325
git_index_free(data->index);
23282326
data->index = NULL;
23292327

23302328
git_strmap_free(data->mkdir_map);
2329+
data->mkdir_map = NULL;
23312330

23322331
git_attr_session__free(&data->attr_session);
23332332
}

0 commit comments

Comments
 (0)