Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79306d8

Browse files
committed
filter::stream: free the filter sanely
Don't use the filter's free callback to free the actual data structure holding the filter, as we may not always actually initialize it (the test may be skipped).
1 parent aa92c31 commit 79306d8

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

tests/filter/stream.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ void test_filter_stream__cleanup(void)
2525
g_repo = NULL;
2626

2727
git_filter_unregister("compress");
28+
git__free(compress_filter);
2829
}
2930

3031
#define CHUNKSIZE 10240
@@ -123,11 +124,6 @@ static int compress_filter_stream_init(
123124
return 0;
124125
}
125126

126-
static void compress_filter_free(git_filter *f)
127-
{
128-
git__free(f);
129-
}
130-
131127
git_filter *create_compress_filter(void)
132128
{
133129
git_filter *filter = git__calloc(1, sizeof(git_filter));
@@ -136,7 +132,6 @@ git_filter *create_compress_filter(void)
136132
filter->version = GIT_FILTER_VERSION;
137133
filter->attributes = "+compress";
138134
filter->stream = compress_filter_stream_init;
139-
filter->shutdown = compress_filter_free;
140135

141136
return filter;
142137
}

0 commit comments

Comments
 (0)