q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9ea802c841d7f375d3a6869bd202f22fd3812443

commit 9ea802c841d7f375d3a6869bd202f22fd3812443
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Mon Jun 8 10:56:54 2015 +0100

    eolian/generator: fix a false positive in eolian types_gen
    
    While it is true that 'strrchr' may return NULL, in this case it
    never will (there is always a newline). Either way, silence Coverity.
    
    Fixes CID 1304558.
---
 src/bin/eolian/types_generator.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index 93740e2..3bdd5d3 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -101,11 +101,15 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
                    if (fdesc) eina_strbuf_append_printf(buf, " /** %s */", 
fdesc);
                    else if (fdoc)
                      {
-                        Eina_Strbuf *fbuf = docs_generate_full(fdoc,
-                            strlen(strrchr(eina_strbuf_string_get(buf), 
'\n')));
-                        if (fbuf) eina_strbuf_append_printf(buf, " %s",
-                            eina_strbuf_string_get(fbuf));
-                        eina_strbuf_free(fbuf);
+                        const char *nl = strrchr(eina_strbuf_string_get(buf), 
'\n');
+                        if (nl)
+                          {
+                             Eina_Strbuf *fbuf = docs_generate_full(fdoc, 
strlen(nl));
+                             if (fbuf)
+                               eina_strbuf_append_printf(buf, " %s",
+                                                         
eina_strbuf_string_get(fbuf));
+                             eina_strbuf_free(fbuf);
+                          }
                      }
                    eina_strbuf_append(buf, "\n");
                 }
@@ -165,11 +169,15 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
                    if (fdesc) eina_strbuf_append_printf(buf, " /** %s */", 
fdesc);
                    else if (fdoc)
                      {
-                        Eina_Strbuf *fbuf = docs_generate_full(fdoc,
-                            strlen(strrchr(eina_strbuf_string_get(buf), 
'\n')));
-                        if (fbuf) eina_strbuf_append_printf(buf, " %s",
-                            eina_strbuf_string_get(fbuf));
-                        eina_strbuf_free(fbuf);
+                        const char *nl = strrchr(eina_strbuf_string_get(buf), 
'\n');
+                        if (nl)
+                          {
+                             Eina_Strbuf *fbuf = docs_generate_full(fdoc, 
strlen(nl));
+                             if (fbuf)
+                               eina_strbuf_append_printf(buf, " %s",
+                                                         
eina_strbuf_string_get(fbuf));
+                             eina_strbuf_free(fbuf);
+                          }
                      }
                    eina_strbuf_append(buf, "\n");
                 }

-- 


Reply via email to