1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Use g_strndup in c_api.c

This commit is contained in:
James Booth 2016-07-27 21:32:44 +01:00
parent ae003e62fb
commit 6c1fef522a

View File

@ -365,9 +365,9 @@ static char *
_c_plugin_name(const char *filename) _c_plugin_name(const char *filename)
{ {
GString *plugin_name_str = g_string_new(""); GString *plugin_name_str = g_string_new("");
char *name = strndup(filename, strlen(filename)-1); gchar *name = g_strndup(filename, strlen(filename)-1);
g_string_append(plugin_name_str, name); g_string_append(plugin_name_str, name);
free(name); g_free(name);
g_string_append(plugin_name_str, "so"); g_string_append(plugin_name_str, "so");
char *result = plugin_name_str->str; char *result = plugin_name_str->str;
g_string_free(plugin_name_str, FALSE); g_string_free(plugin_name_str, FALSE);