diff options
author | Xu Guangxin <guangxin.xu@intel.com> | 2019-01-14 12:32:45 +0800 |
---|---|---|
committer | XinfengZhang <carl.zhang@intel.com> | 2019-05-09 15:25:35 +0800 |
commit | 42b9d364204f281ec1ca6e9a57816c17b2ca4a76 (patch) | |
tree | e8afb24b5184339a39c90242e13d844fb2eb0a39 | |
parent | 1f2523a47d7ab544737fc0fdf2361dafe17732f0 (diff) | |
download | libva-42b9d364204f281ec1ca6e9a57816c17b2ca4a76.tar.gz |
va_openDriver: check strdup return value
strdup may return NULL when out of memory.
If we pass this NULL to strtok_r,it returns unflushed token from previous
strtok_r call. It's unexpected result.
-rw-r--r-- | va/va.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -381,6 +381,11 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) search_path = VA_DRIVERS_PATH; search_path = strdup((const char *)search_path); + if (!search_path) { + va_errorMessage(dpy, "%s L%d Out of memory\n", + __FUNCTION__, __LINE__); + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } driver_dir = strtok_r(search_path, ":", &saveptr); while (driver_dir) { void *handle = NULL; |