libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libjit] [PATCH 4/4] Verify return value of jit_value_get_function


From: Niklas Koep
Subject: [Libjit] [PATCH 4/4] Verify return value of jit_value_get_function
Date: Sat, 22 Mar 2014 21:25:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Signed-off-by: Niklas Koep <address@hidden>
---
 jit/jit-value.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/jit/jit-value.c b/jit/jit-value.c
index 387b2e4..10790e1 100644
--- a/jit/jit-value.c
+++ b/jit/jit-value.c
@@ -749,12 +749,10 @@ jit_function_t jit_value_get_function(jit_value_t value)
 {
        if(value)
        {
-               return value->block->func;
-       }
-       else
-       {
-               return 0;
+               if(_jit_function_ensure_builder(value->block->func))
+                       return value->block->func;
        }
+    return 0;
 }
  /*@
@@ -781,9 +779,12 @@ jit_block_t jit_value_get_block(jit_value_t value)
 @*/
 jit_context_t jit_value_get_context(jit_value_t value)
 {
-       if(value)
+       jit_function_t function;
+
+       function = jit_value_get_function(value);
+       if(function)
        {
-               return value->block->func->context;
+               return function->context;
        }
        else
        {
--
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]