[PATCH] riched20: check for NULL in rtf reader (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Dec 2 17:33:02 CST 2009


Hi,

If we encounter a NULL ptr after allocation, just break
out of the loop.

Ciao, Marcus
---
 dlls/riched20/reader.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c
index a589a8e..c48455c 100644
--- a/dlls/riched20/reader.c
+++ b/dlls/riched20/reader.c
@@ -1108,8 +1108,10 @@ static void ReadStyleSheet(RTF_Info *info)
 					continue;
 				}
 				sep = New (RTFStyleElt);
-				if (sep == NULL)
+				if (sep == NULL) {
 					ERR ( "%s: cannot allocate style element\n", fn);
+					break;
+				}
 				sep->rtfSEClass = info->rtfClass;
 				sep->rtfSEMajor = info->rtfMajor;
 				sep->rtfSEMinor = info->rtfMinor;
-- 
1.5.6



More information about the wine-patches mailing list