summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-24 23:48:24 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-25 20:59:24 +0200
commitf79153ace75920b2b9c5be5f4ee324f1652ad652 (patch)
tree461958acb757ffef7d96eb2bf4f6b05beafbad2a /src/plugins
parent7ee57af8e3acd45766a37fe45df8d52b8c31de07 (diff)
downloadweechat-f79153ace75920b2b9c5be5f4ee324f1652ad652.zip
ruby: remove check of NULL pointers before calling free() (issue #865)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c11
-rw-r--r--src/plugins/ruby/weechat-ruby.c15
2 files changed, 8 insertions, 18 deletions
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index d70108878..9d0bde678 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -1523,9 +1523,7 @@ weechat_ruby_api_config_option_change_cb (const void *pointer, void *data,
WEECHAT_SCRIPT_EXEC_IGNORE,
ptr_function,
"ss", func_argv);
-
- if (rc)
- free (rc);
+ free (rc);
}
}
@@ -1550,9 +1548,7 @@ weechat_ruby_api_config_option_delete_cb (const void *pointer, void *data,
WEECHAT_SCRIPT_EXEC_IGNORE,
ptr_function,
"ss", func_argv);
-
- if (rc)
- free (rc);
+ free (rc);
}
}
@@ -3664,8 +3660,7 @@ weechat_ruby_api_hook_print_cb (const void *pointer, void *data,
ret = *rc;
free (rc);
}
- if (func_argv[3])
- free (func_argv[3]);
+ free (func_argv[3]);
return ret;
}
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c
index f6cd048ce..2390d635d 100644
--- a/src/plugins/ruby/weechat-ruby.c
+++ b/src/plugins/ruby/weechat-ruby.c
@@ -437,8 +437,7 @@ weechat_ruby_output (VALUE self, VALUE str)
}
weechat_string_dyn_concat (ruby_buffer_output, ptr_msg, -1);
- if (msg)
- free (msg);
+ free (msg);
return Qnil;
}
@@ -762,8 +761,7 @@ weechat_ruby_unload (struct t_plugin_script *script)
WEECHAT_SCRIPT_EXEC_INT,
script->shutdown_func,
0, NULL);
- if (rc)
- free (rc);
+ free (rc);
}
filename = strdup (script->filename);
@@ -781,8 +779,7 @@ weechat_ruby_unload (struct t_plugin_script *script)
(void) weechat_hook_signal_send ("ruby_script_unloaded",
WEECHAT_HOOK_SIGNAL_STRING, filename);
- if (filename)
- free (filename);
+ free (filename);
}
/*
@@ -899,8 +896,7 @@ weechat_ruby_eval (struct t_gui_buffer *buffer, int send_to_buffer_as_input,
"script_ruby_eval",
"s", func_argv);
/* result is ignored */
- if (result)
- free (result);
+ free (result);
weechat_ruby_output_flush ();
@@ -1006,8 +1002,7 @@ weechat_ruby_command_cb (const void *pointer, void *data,
ptr_name, 1);
weechat_ruby_load ((path_script) ? path_script : ptr_name,
NULL);
- if (path_script)
- free (path_script);
+ free (path_script);
}
else if (weechat_strcmp (argv[1], "reload") == 0)
{