[Mplayer-cvslog] CVS: main/libmpdemux demuxer.c,1.51,1.52

Arpi of Ize arpi at mplayer.dev.hu
Tue Nov 27 01:42:41 CET 2001


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv3573

Modified Files:
	demuxer.c 
Log Message:
bad malloc+strcpy => strdup

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- demuxer.c	24 Nov 2001 23:58:12 -0000	1.51
+++ demuxer.c	27 Nov 2001 00:42:39 -0000	1.52
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <sys/types.h>
@@ -654,8 +655,7 @@
 	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->name already present\n!");
 	    return(0);
 	}
-	info->name = malloc(strlen(param));
-	strcpy(info->name, param);
+	info->name = strdup(param);
 	return(1);
     }
 
@@ -666,8 +666,7 @@
 	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->author already present\n!");
 	    return(0);
 	}
-	info->author = malloc(strlen(param));
-	strcpy(info->author, param);
+	info->author = strdup(param);
 	return(1);
     }
 
@@ -678,8 +677,7 @@
 	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->encoder already present\n!");
 	    return(0);
 	}
-	info->encoder = malloc(strlen(param));
-	strcpy(info->encoder, param);
+	info->encoder = strdup(param);
 	return(1);
     }
 
@@ -690,8 +688,7 @@
 	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->comments already present\n!");
 	    return(0);
 	}
-	info->comments = malloc(strlen(param));
-	strcpy(info->comments, param);
+	info->comments = strdup(param);
 	return(1);
     }
 
@@ -702,8 +699,7 @@
 	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->copyright already present\n!");
 	    return(0);
 	}
-	info->copyright = malloc(strlen(param));
-	strcpy(info->copyright, param);
+	info->copyright = strdup(param);
 	return(1);
     }
 




More information about the MPlayer-cvslog mailing list