Jacek Caban : jscript: Fixed compare function check in Array.sort (Coverity ).

Alexandre Julliard julliard at winehq.org
Tue Oct 7 08:54:12 CDT 2008


Module: wine
Branch: master
Commit: 0c20b1d0a11161027983d3af9e14181b846d0cf6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c20b1d0a11161027983d3af9e14181b846d0cf6

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Oct  6 09:57:39 2008 -0500

jscript: Fixed compare function check in Array.sort (Coverity).

---

 dlls/jscript/array.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 43cc61f..c4d7399 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -433,9 +433,10 @@ static HRESULT Array_sort(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
 
 
         cmp_func = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg));
-        if(!is_class(cmp_func, JSCLASS_FUNCTION)) {
+        if(!cmp_func || !is_class(cmp_func, JSCLASS_FUNCTION)) {
             WARN("cmp_func is not a function\n");
-            jsdisp_release(cmp_func);
+            if(cmp_func)
+                jsdisp_release(cmp_func);
             return E_FAIL;
         }
     }




More information about the wine-cvs mailing list