[PATCH 4/4] Replace malloc + memset by calloc

Clément Bœsch ubitux at gmail.com
Thu Nov 4 01:24:13 CET 2010


---
 stream/network.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/stream/network.c b/stream/network.c
index 6f034e9..f8cda3c 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -111,13 +111,11 @@ const mime_struct_t mime_type_table[] = {
 
 streaming_ctrl_t *
 streaming_ctrl_new(void) {
-	streaming_ctrl_t *streaming_ctrl;
-	streaming_ctrl = malloc(sizeof(streaming_ctrl_t));
+	streaming_ctrl_t *streaming_ctrl = calloc(1, sizeof(*streaming_ctrl));
 	if( streaming_ctrl==NULL ) {
 		mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 		return NULL;
 	}
-	memset( streaming_ctrl, 0, sizeof(streaming_ctrl_t) );
 	return streaming_ctrl;
 }
 
-- 
1.7.3.2


--61jdw2sOBCFtR2d/--


More information about the MPlayer-dev-eng mailing list