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
45 45
46 if (!s.temp_dwt_buffer || !s.temp_idwt_buffer) {46 if (!s.temp_dwt_buffer || !s.temp_idwt_buffer) {
47 fprintf(stderr, "Failed to allocate memory\n");47 fprintf(stderr, "Failed to allocate memory\n");
48 return 1;48 ret = 1;
49 goto end;
49 }50 }
50 51
51 av_lfg_init(&prng, 1);52 av_lfg_init(&prng, 1);
@@ -145,5 +146,9 @@ int main(void){ · 93 unmodified lines
145 }146 }
146 147
147 }148 }
149
150end:
151 av_free(s.temp_dwt_buffer);
152 av_free(s.temp_idwt_buffer);
148 return ret;153 return ret;
149}154}

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