[Mplayer-cvslog] CVS: main/libmpdemux url.c,1.17,1.18
Bertrand Baudet
bertrand at mplayerhq.hu
Sun Oct 20 01:29:06 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv24573
Modified Files:
url.c
Log Message:
Fixed more potential mem leaks and use the url_free method
to free all the member pointers of the url.
Index: url.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/url.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- url.c 16 Oct 2002 20:25:23 -0000 1.17
+++ url.c 19 Oct 2002 23:28:51 -0000 1.18
@@ -33,7 +33,7 @@
Curl->url = strdup(url);
if( Curl->url==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
- free(Curl);
+ url_free(Curl);
return NULL;
}
@@ -41,7 +41,7 @@
ptr1 = strstr(url, "://");
if( ptr1==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_V,"Not an URL!\n");
- free(Curl->url);free(Curl);
+ url_free(Curl);
return NULL;
}
pos1 = ptr1-url;
@@ -49,7 +49,7 @@
strncpy(Curl->protocol, url, pos1);
if( Curl->protocol==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
- free(Curl->protocol);free(Curl->url);free(Curl);
+ url_free(Curl);
return NULL;
}
Curl->protocol[pos1] = '\0';
@@ -71,6 +71,7 @@
Curl->username = (char*)malloc(len+1);
if( Curl->username==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
+ url_free(Curl);
return NULL;
}
strncpy(Curl->username, ptr1, len);
@@ -84,6 +85,7 @@
Curl->password = (char*)malloc(len2+1);
if( Curl->password==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
+ url_free(Curl);
return NULL;
}
strncpy( Curl->password, ptr3+1, len2);
@@ -120,6 +122,7 @@
Curl->hostname = (char*)malloc(pos2-pos1+1);
if( Curl->hostname==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
+ url_free(Curl);
return NULL;
}
strncpy(Curl->hostname, ptr1, pos2-pos1);
@@ -135,6 +138,7 @@
Curl->file = strdup(ptr2);
if( Curl->file==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
+ url_free(Curl);
return NULL;
}
}
@@ -144,6 +148,7 @@
Curl->file = (char*)malloc(2);
if( Curl->file==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
+ url_free(Curl);
return NULL;
}
strcpy(Curl->file, "/");
More information about the MPlayer-cvslog
mailing list