Mercurial > mplayer.hg
comparison loader/dshow/cmediasample.c @ 24347:89347ff2c31a
Avoid releasing of unallocated memory.
Patch is made from coreavc-for-linux project source code
http://code.google.com/p/coreavc-for-linux/
author | voroshil |
---|---|
date | Sat, 08 Sep 2007 12:15:15 +0000 |
parents | bf37d4ba4b65 |
children | 614f9efc91a8 |
comparison
equal
deleted
inserted
replaced
24346:9fb68e85180a | 24347:89347ff2c31a |
---|---|
80 { | 80 { |
81 | 81 |
82 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); | 82 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); |
83 free(This->vt); | 83 free(This->vt); |
84 free(This->own_block); | 84 free(This->own_block); |
85 if(((CMediaSample*)This)->type_valid) | |
85 FreeMediaType(&(This->media_type)); | 86 FreeMediaType(&(This->media_type)); |
86 free(This); | 87 free(This); |
87 } | 88 } |
88 | 89 |
89 /** | 90 /** |
373 AM_MEDIA_TYPE* t; | 374 AM_MEDIA_TYPE* t; |
374 Debug printf("CMediaSample_SetMediaType(%p) called\n", This); | 375 Debug printf("CMediaSample_SetMediaType(%p) called\n", This); |
375 if (!pMediaType) | 376 if (!pMediaType) |
376 return E_INVALIDARG; | 377 return E_INVALIDARG; |
377 t = &((CMediaSample*)This)->media_type; | 378 t = &((CMediaSample*)This)->media_type; |
379 if(((CMediaSample*)This)->type_valid) | |
378 FreeMediaType(t); | 380 FreeMediaType(t); |
379 CopyMediaType(t,pMediaType); | 381 CopyMediaType(t,pMediaType); |
380 ((CMediaSample*) This)->type_valid=1; | 382 ((CMediaSample*) This)->type_valid=1; |
381 | 383 |
382 return 0; | 384 return 0; |