diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2014-02-14 12:15:25 +0800 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2014-03-03 16:32:32 +0100 |
commit | d92718942612bbc4b05fb6387d1945fbf94fff14 (patch) | |
tree | 8a2d6bb4b375efeebae60b01c87405f795d461f2 /test/vainfo | |
parent | a7c4603a40e7c17da9a2d4c209b88f83b607f458 (diff) |
vainfo: clean up resource in the error handling path
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Diffstat (limited to 'test/vainfo')
-rw-r--r-- | test/vainfo/vainfo.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/vainfo/vainfo.c b/test/vainfo/vainfo.c index 16a2837..9fffb57 100644 --- a/test/vainfo/vainfo.c +++ b/test/vainfo/vainfo.c @@ -33,7 +33,8 @@ #define CHECK_VASTATUS(va_status,func, ret) \ if (va_status != VA_STATUS_SUCCESS) { \ fprintf(stderr,"%s failed with error code %d (%s),exit\n",func, va_status, vaErrorStr(va_status)); \ - exit(ret); \ + ret_val = ret; \ + goto error; \ } static char * profile_string(VAProfile profile) @@ -90,6 +91,7 @@ int main(int argc, const char* argv[]) VAProfile profile; VAEntrypoint entrypoint, entrypoints[10]; int num_entrypoint; + int ret_val = 0; if (name) name++; @@ -128,8 +130,9 @@ int main(int argc, const char* argv[]) printf(" %-32s: %s\n", profile_str, entrypoint_string(entrypoints[entrypoint])); } +error: vaTerminate(va_dpy); va_close_display(va_dpy); - return 0; + return ret_val; } |