wrc: Fix redundant checks for NULL before free(). Found by Smatch.

Michael Stefaniuc mstefani at redhat.de
Wed Jun 13 16:52:17 CDT 2007


---
 tools/wrc/parser.y |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index 595042c..5806620 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -531,8 +531,7 @@ resource
 
 		if(!win32)
 			parser_warning("LANGUAGE not supported in 16-bit mode");
-		if(currentlanguage)
-			free(currentlanguage);
+		free(currentlanguage);
 		if (get_language_codepage($3, $5) == -1)
 			parser_error( "Language %04x is not supported", ($5<<10) + $3);
 		currentlanguage = new_language($3, $5);
@@ -1460,11 +1459,8 @@ stringtable
 			 }
 			 /* Else were done */
 		}
-		if(tagstt_memopt)
-		{
-			free(tagstt_memopt);
-			tagstt_memopt = NULL;
-		}
+		free(tagstt_memopt);
+		tagstt_memopt = NULL;
 
 		$$ = tagstt;
 		}
@@ -1477,8 +1473,7 @@ stt_head: tSTRINGTABLE loadmemopts opt_lvc {
 		tagstt_memopt = $2;
 		tagstt_version = $3->version;
 		tagstt_characts = $3->characts;
-		if($3)
-			free($3);
+		free($3);
 		}
 	;
 
-- 
1.5.0.6


-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070613/a00bdeba/attachment.pgp


More information about the wine-patches mailing list