# HG changeset patch # User alex # Date 1050955963 0 # Node ID 6454a2ba2e3327ca31e79b6b8e500da6ef67d782 # Parent 305cc11b27e5be096640cd8881e787202de822d2 CoTaskMemAlloc/Free vs malloc/free cleanup diff -r 305cc11b27e5 -r 6454a2ba2e33 loader/dshow/cmediasample.c --- a/loader/dshow/cmediasample.c Mon Apr 21 20:09:08 2003 +0000 +++ b/loader/dshow/cmediasample.c Mon Apr 21 20:12:43 2003 +0000 @@ -47,7 +47,7 @@ free(This->vt); free(This->own_block); if (This->media_type.pbFormat) - CoTaskMemFree(This->media_type.pbFormat); + free(This->media_type.pbFormat); free(This); } @@ -171,10 +171,10 @@ } t = &((CMediaSample*)This)->media_type; - // if(t.pbFormat)CoTaskMemFree(t.pbFormat); - (*ppMediaType) = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + // if(t.pbFormat)free(t.pbFormat); + (*ppMediaType) = (AM_MEDIA_TYPE*)malloc(sizeof(AM_MEDIA_TYPE)); **ppMediaType = *t; - (*ppMediaType)->pbFormat = (char*)CoTaskMemAlloc(t->cbFormat); + (*ppMediaType)->pbFormat = (char*)malloc(t->cbFormat); memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat); // *ppMediaType=0; //media type was not changed return 0; @@ -189,11 +189,11 @@ return E_INVALIDARG; t = &((CMediaSample*)This)->media_type; if (t->pbFormat) - CoTaskMemFree(t->pbFormat); + free(t->pbFormat); t = pMediaType; if (t->cbFormat) { - t->pbFormat = (char*)CoTaskMemAlloc(t->cbFormat); + t->pbFormat = (char*)malloc(t->cbFormat); memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat); } else diff -r 305cc11b27e5 -r 6454a2ba2e33 loader/dshow/inputpin.c --- a/loader/dshow/inputpin.c Mon Apr 21 20:09:08 2003 +0000 +++ b/loader/dshow/inputpin.c Mon Apr 21 20:12:43 2003 +0000 @@ -173,7 +173,7 @@ *pmt=((CInputPin*)This)->type; if (pmt->cbFormat > 0) { - pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat); + pmt->pbFormat=(char *)malloc(pmt->cbFormat); memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat); } return 0; diff -r 305cc11b27e5 -r 6454a2ba2e33 loader/dshow/outputpin.c --- a/loader/dshow/outputpin.c Mon Apr 21 20:09:08 2003 +0000 +++ b/loader/dshow/outputpin.c Mon Apr 21 20:12:43 2003 +0000 @@ -51,12 +51,12 @@ if (pcFetched) *pcFetched=1; - ppMediaTypes[0] = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + ppMediaTypes[0] = (AM_MEDIA_TYPE *)malloc(sizeof(AM_MEDIA_TYPE)); // copy structures - C can handle this... **ppMediaTypes = *type; if (ppMediaTypes[0]->pbFormat) { - ppMediaTypes[0]->pbFormat=(char *)CoTaskMemAlloc(ppMediaTypes[0]->cbFormat); + ppMediaTypes[0]->pbFormat=(char *)malloc(ppMediaTypes[0]->cbFormat); memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat); } if (cMediaTypes == 1) @@ -171,7 +171,7 @@ *pmt=((COutputPin*)This)->type; if(pmt->cbFormat>0) { - pmt->pbFormat=CoTaskMemAlloc(pmt->cbFormat); + pmt->pbFormat=malloc(pmt->cbFormat); memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat); } */ @@ -214,7 +214,7 @@ *pmt = ((COutputPin*)This)->type; if (pmt->cbFormat>0) { - pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat); + pmt->pbFormat=(char *)malloc(pmt->cbFormat); memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat); } return 0;