Eina Example: Fix memory leak of variable buf
authorYeshwanth Reddivari <r.yeshwanth@samsung.com>
Mon, 23 Nov 2015 12:04:15 +0000 (21:04 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 23 Nov 2015 12:04:15 +0000 (21:04 +0900)
Summary: Fix memory leak of buf in eina_test_simple_xml_parser.c as reported by static analysis tool, Cppcheck.

Reviewers: singh.amitesh, Hermet, jpeg

Reviewed By: jpeg

Subscribers: alok25, mvsovani, sachin.dev, cedric

Differential Revision: https://phab.enlightenment.org/D3371

src/tests/eina/eina_test_simple_xml_parser.c

index 5e55082..ef056f1 100644 (file)
@@ -78,8 +78,8 @@ START_TEST(eina_simple_xml_parser_node_dump)
                        ck_assert_str_eq(out, buf);
                        free(out);
                        eina_simple_xml_node_root_free(root);
-                       free(buf);
                     }
+                  free(buf);
                }
           }
         fclose(f);
@@ -251,9 +251,9 @@ START_TEST(eina_simple_xml_parser_parse_with_custom_callback)
                                           EINA_TRUE,
                                           eina_simple_xml_parser_parse_with_custom_callback_tag_cb,
                                           &parse_current_state);
-                    free(buf);
                     fail_if(parse_current_state != simple_xml_parser_current_state_end);
                   }
+                free(buf);
               }
           }