[monitoring-plugins] lib/parse_ini.c: Don't cast malloc(3) result

Holger Weiss git at monitoring-plugins.org
Wed Jun 18 01:40:08 CEST 2014


 Module: monitoring-plugins
 Branch: master
 Commit: e2b816986926e91227fc151af99bcf6dd5f68e74
 Author: Holger Weiss <holger at zedat.fu-berlin.de>
   Date: Wed Jun 18 01:21:31 2014 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=e2b8169

lib/parse_ini.c: Don't cast malloc(3) result

There's no need to cast malloc(3)'s return value.

---

 lib/parse_ini.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 2e42df7..51ad2c1 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -274,11 +274,11 @@ static int add_option(FILE *f, np_arg_list **optlst){
 	/* okay, now we have all the info we need, so we create a new np_arg_list
 	 * element and set the argument...
 	 */
-	optnew=(np_arg_list *)malloc(sizeof(np_arg_list));
+	optnew=malloc(sizeof(np_arg_list));
 	optnew->next=NULL;
 
 	read_pos=0;
-	optnew->arg=(char *)malloc(cfg_len+1);
+	optnew->arg=malloc(cfg_len+1);
 	/* 1-character params needs only one dash */
 	if(opt_len==1) {
 		strncpy(&optnew->arg[read_pos], "-", 1);



More information about the Commits mailing list