seoz pushed a commit to branch master.

commit ef79eeead02712233b4d161f5e0e59633aa23f3a
Author: Daniel Juyung Seo <[email protected]>
Date:   Sun Aug 11 15:38:16 2013 +0900

    elm_prefs_cc_parse.c: tok null check in advance.
    
    This fixes coverity CID 1040003 Dereference before null check 
(REVERSE_INULL).
---
 src/bin/elm_prefs_cc_parse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bin/elm_prefs_cc_parse.c b/src/bin/elm_prefs_cc_parse.c
index 2e44c46..8e2bae3 100644
--- a/src/bin/elm_prefs_cc_parse.c
+++ b/src/bin/elm_prefs_cc_parse.c
@@ -388,6 +388,7 @@ done:
    *new_p = p;
 
    tok = mem_alloc(tok_end - tok_start + 2);
+   if (!tok) return NULL;
    strncpy(tok, tok_start, tok_end - tok_start + 1);
    tok[tok_end - tok_start + 1] = 0;
 
@@ -425,7 +426,7 @@ done:
                }
           }
      }
-   else if ((tok) && (*tok == '('))
+   else if (*tok == '(')
      {
         char *tmp;
         tmp = tok;

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

Reply via email to