[tracker/wip/carlosg/coverity-warnings: 14/18] libtracker-sparql: Plug leak on API misuse
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/coverity-warnings: 14/18] libtracker-sparql: Plug leak on API misuse
- Date: Sun, 21 Mar 2021 20:56:35 +0000 (UTC)
commit 210cfeecfdfd41a0bc5010b138c05a40a06cf2bb
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Mar 20 13:23:18 2021 +0100
libtracker-sparql: Plug leak on API misuse
If we use the g_return_val_if_fail(), the string builder is leaked.
CID: #1501138
src/libtracker-sparql/tracker-namespace-manager.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-sparql/tracker-namespace-manager.c
b/src/libtracker-sparql/tracker-namespace-manager.c
index e9b2456fd..c0e5f90bb 100644
--- a/src/libtracker-sparql/tracker-namespace-manager.c
+++ b/src/libtracker-sparql/tracker-namespace-manager.c
@@ -300,7 +300,7 @@ char *
tracker_namespace_manager_print_turtle (TrackerNamespaceManager *self)
{
TrackerNamespaceManagerPrivate *priv;
- GString *result = g_string_new ("");
+ GString *result;
GHashTableIter iter;
const char *prefix;
const char *namespace;
@@ -309,6 +309,8 @@ tracker_namespace_manager_print_turtle (TrackerNamespaceManager *self)
priv = GET_PRIVATE (self);
+ result = g_string_new ("")
+
g_hash_table_iter_init (&iter, priv->prefix_to_namespace);
while (g_hash_table_iter_next (&iter, (gpointer *)&prefix, (gpointer *)&namespace)) {
g_string_append_printf (result, "@prefix %s: <%s> .\n", prefix, namespace);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]