[Libva] [PATCH V3 3/3] Check the value returned by strstr to avoid NULL pointer

Zhao Yakui yakui.zhao at intel.com
Thu Sep 25 18:18:25 PDT 2014


Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/i965_device_info.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index 29757e2..6fb3700 100755
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -444,7 +444,9 @@ static void hsw_hw_codec_preinit(VADriverContextP ctx, struct hw_codec_info *cod
     /* strip the cpufreq info */
     model_ptr = model_string;
     tmp_ptr = strstr(model_ptr, "@");
-    *tmp_ptr = '\0';
+   
+    if (tmp_ptr)
+        *tmp_ptr = '\0';
 
     /* strip the space character and convert to the lower case */
     model_ptr = model_string;
-- 
1.7.10.1



More information about the Libva mailing list