[Mplayer-cvslog] CVS: main/loader/dshow cmediasample.c,1.9,1.10 inputpin.c,1.7,1.8 outputpin.c,1.11,1.12

Alex Beregszaszi alex at mplayerhq.hu
Mon Apr 21 22:12:48 CEST 2003


Update of /cvsroot/mplayer/main/loader/dshow
In directory mail:/var/tmp.root/cvs-serv11705

Modified Files:
	cmediasample.c inputpin.c outputpin.c 
Log Message:
CoTaskMemAlloc/Free vs malloc/free cleanup

Index: cmediasample.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/dshow/cmediasample.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- cmediasample.c	26 Nov 2002 21:00:20 -0000	1.9
+++ cmediasample.c	21 Apr 2003 20:12:43 -0000	1.10
@@ -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

Index: inputpin.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/dshow/inputpin.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- inputpin.c	13 Sep 2002 19:43:15 -0000	1.7
+++ inputpin.c	21 Apr 2003 20:12:43 -0000	1.8
@@ -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;

Index: outputpin.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/dshow/outputpin.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- outputpin.c	26 Nov 2002 21:00:20 -0000	1.11
+++ outputpin.c	21 Apr 2003 20:12:43 -0000	1.12
@@ -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;



More information about the MPlayer-cvslog mailing list