osd: free buffer allocated with av_malloc with av_free

free() was used before, which could in theory lead to crashes if
the OSD buffer was freed or resized. (Whether using free() actually
works depends on what function libavutil's av_malloc() uses internally.
On Linux, it seems to use memalign(), which uses free() as counterpart
for deallocation, so the bug never triggered for me.)
This commit is contained in:
wm4 2012-08-04 22:18:58 +02:00
parent f7e9c15c7b
commit a62b9cf7a3
1 changed files with 4 additions and 4 deletions

View File

@ -99,8 +99,8 @@ void osd_alloc_buf(mp_osd_obj_t* obj)
len = obj->stride*(obj->bbox.y2-obj->bbox.y1);
if (obj->allocated<len) {
obj->allocated = len;
free(obj->bitmap_buffer);
free(obj->alpha_buffer);
av_free(obj->bitmap_buffer);
av_free(obj->alpha_buffer);
obj->bitmap_buffer = av_malloc(len);
obj->alpha_buffer = av_malloc(len);
}
@ -211,8 +211,8 @@ void osd_free(struct osd_state *osd)
mp_osd_obj_t* obj=vo_osd_list;
while(obj){
mp_osd_obj_t* next=obj->next;
free(obj->alpha_buffer);
free(obj->bitmap_buffer);
av_free(obj->alpha_buffer);
av_free(obj->bitmap_buffer);
free(obj);
obj=next;
}