History

libavcodec/tests/snowenc: Add av_free() to avoid memory leak

Add av_free() to free s.temp_dwt_buffer and s.temp_idwt_buffer at the end of the function to avoid memory leak.

Jiasheng Jiang committed 1 year ago

Commit 446cfbf1 parent a2546241 file · +6 −1Browse files

Unified · Split

libavcodec/tests/snowenc.c+6−1
@@ -45,7 +45,8 @@ int main(void){ · 44 unmodified lines
4545
4646 if (!s.temp_dwt_buffer || !s.temp_idwt_buffer) {
4747 fprintf(stderr, "Failed to allocate memory\n");
48− return 1;
48+ ret = 1;
49+ goto end;
4950 }
5051
5152 av_lfg_init(&prng, 1);
@@ -145,5 +146,9 @@ int main(void){ · 93 unmodified lines
145146 }
146147
147148 }
149+
150+end:
151+ av_free(s.temp_dwt_buffer);
152+ av_free(s.temp_idwt_buffer);
148153 return ret;
149154 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t