Michael Stefaniuc : wrc: Remove redundant NULL check before free(). Found by Smatch.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 09:55:22 CDT 2007


Module: wine
Branch: master
Commit: e01e8a019268509f435ec12188cb6ccf354a54c0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e01e8a019268509f435ec12188cb6ccf354a54c0

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Sun Oct 21 01:14:38 2007 +0200

wrc: Remove redundant NULL check before free(). Found by Smatch.

---

 tools/wrc/parser.y |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index 1c4cdaa..0af5330 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -1376,16 +1376,16 @@ itemex_options
 		$$->gotid = TRUE;
 		$$->gottype = TRUE;
 		$$->gotstate = TRUE;
-		if($2) free($2);
-		if($4) free($4);
+		free($2);
+		free($4);
 		}
 	| ',' e_expr ',' e_expr ',' expr {
 		$$ = new_itemex_opt($2 ? *($2) : 0, $4 ? *($4) : 0, $6, 0);
 		$$->gotid = TRUE;
 		$$->gottype = TRUE;
 		$$->gotstate = TRUE;
-		if($2) free($2);
-		if($4) free($4);
+		free($2);
+		free($4);
 		}
 	;
 
@@ -1397,23 +1397,23 @@ itemex_p_options
 		}
 	| ',' e_expr ',' expr {
 		$$ = new_itemex_opt($2 ? *($2) : 0, $4, 0, 0);
-		if($2) free($2);
+		free($2);
 		$$->gotid = TRUE;
 		$$->gottype = TRUE;
 		}
 	| ',' e_expr ',' e_expr ',' expr {
 		$$ = new_itemex_opt($2 ? *($2) : 0, $4 ? *($4) : 0, $6, 0);
-		if($2) free($2);
-		if($4) free($4);
+		free($2);
+		free($4);
 		$$->gotid = TRUE;
 		$$->gottype = TRUE;
 		$$->gotstate = TRUE;
 		}
 	| ',' e_expr ',' e_expr ',' e_expr ',' expr {
 		$$ = new_itemex_opt($2 ? *($2) : 0, $4 ? *($4) : 0, $6 ? *($6) : 0, $8);
-		if($2) free($2);
-		if($4) free($4);
-		if($6) free($6);
+		free($2);
+		free($4);
+		free($6);
 		$$->gotid = TRUE;
 		$$->gottype = TRUE;
 		$$->gotstate = TRUE;




More information about the wine-cvs mailing list