<p><b>@b4n</b> requested changes on this pull request.</p>

<p>Leaks should be fixed.</p><hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/755#discussion_r195467371">geanyctags/src/geanyctags.c</a>:</p>
<pre style='color:#555'>> @@ -205,6 +205,26 @@ static gchar *generate_find_string(GeanyProject *prj)
 }
 
 
+static const gchar *get_base_path(void)
+{
+       static gchar *ret = NULL;
+       GeanyProject *prj = geany_data->app->project;
+       gchar *project_dir_utf8;
+
+       if (!prj)
+               return NULL;
+
+       if (g_path_is_absolute(prj->base_path))
+               return prj->base_path;
+
+       g_free(ret);
</pre>
<p>not useful as it's always <code>NULL</code> at this point</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/755#discussion_r195468020">geanyctags/src/geanyctags.c</a>:</p>
<pre style='color:#555'>> @@ -205,6 +205,26 @@ static gchar *generate_find_string(GeanyProject *prj)
 }
 
 
+static const gchar *get_base_path(void)
</pre>
<p>this function has a leaky semantic: it returns <em>either</em> <code>prj->base_path</code> <em>or</em> an allocated buffer.  The caller must then free conditionally, which is tricky at best.</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/755#discussion_r195468214">geanyctags/src/geanyctags.c</a>:</p>
<pre style='color:#555'>> @@ -236,7 +256,7 @@ on_generate_tags(GtkMenuItem *menuitem, gpointer user_data)
                        tag_filename, "\"", NULL);
 #endif
 
-               spawn_cmd(cmd, prj->base_path);
+               spawn_cmd(cmd, get_base_path());
</pre>
<p>leaks when <code>prj->base_path</code> is relative</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/755#discussion_r195468297">geanyctags/src/geanyctags.c</a>:</p>
<pre style='color:#555'>> @@ -421,7 +441,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen
                return;
 
        msgwin_clear_tab(MSG_MESSAGE);
-       msgwin_set_messages_dir(prj->base_path);
+       msgwin_set_messages_dir(get_base_path());
</pre>
<p>same</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/755#discussion_r195468341">geanyctags/src/geanyctags.c</a>:</p>
<pre style='color:#555'>> @@ -445,7 +465,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen
 
                        if (!filter_tag(&entry, name_pat, declaration, case_sensitive))
                        {
-                               path = g_build_filename(prj->base_path, entry.file, NULL);
+                               path = g_build_filename(get_base_path(), entry.file, NULL);
</pre>
<p>more</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/755#discussion_r195468423">geanyctags/src/geanyctags.c</a>:</p>
<pre style='color:#555'>> @@ -456,7 +476,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen
                                if (!filter_tag(&entry, name_pat, declaration, case_sensitive))
                                {
                                        if (!path)
-                                               path = g_build_filename(prj->base_path, entry.file, NULL);
+                                               path = g_build_filename(get_base_path(), entry.file, NULL);
</pre>
<p>and… it's me again <g-emoji class="g-emoji" alias="grin" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f601.png">😁</g-emoji></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/pull/755#pullrequestreview-128843147">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJzbkchadxb3xTDE3DXJj7bZyTtDsks5t8oGqgaJpZM4UoB3u">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJwuUefFUFrk0gDUjueRaLNg9koL7ks5t8oGqgaJpZM4UoB3u.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","potentialAction":{"@type":"ViewAction","target":"https://github.com/geany/geany-plugins/pull/755#pullrequestreview-128843147","url":"https://github.com/geany/geany-plugins/pull/755#pullrequestreview-128843147","name":"View Pull Request"},"description":"View this Pull Request on GitHub","publisher":{"@type":"Organization","name":"GitHub","url":"https://github.com"}}</script>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany-plugins","title":"geany/geany-plugins","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany-plugins"}},"updates":{"snippets":[{"icon":"PERSON","message":"@b4n requested changes on #755"}],"action":{"name":"View Pull Request","url":"https://github.com/geany/geany-plugins/pull/755#pullrequestreview-128843147"}}}</script>
<script type="application/ld+json">{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "@b4n requested changes on 755",
"sections": [
{
"text": "Leaks should be fixed.",
"activityTitle": "**Colomban Wendling**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@b4n",
"facts": [

]
}
],
"potentialAction": [
{
"targets": [
{
"os": "default",
"uri": "https://github.com/geany/geany-plugins/pull/755#pullrequestreview-128843147"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 346037742\n}"
}
],
"themeColor": "26292E"
}</script>