summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-24 23:36:22 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-25 20:59:24 +0200
commit0ac2e54b468dd011e9e5bd5b8a345a5d430eddee (patch)
treec5cf504e504b7caf3bdb3094d3c8349431e2a015
parent3e994e3c5a5c15ad9e501ac1e7ae69d173eddefe (diff)
downloadweechat-0ac2e54b468dd011e9e5bd5b8a345a5d430eddee.zip
perl: remove check of NULL pointers before calling free() (issue #865)
-rw-r--r--src/plugins/perl/weechat-perl-api.c11
-rw-r--r--src/plugins/perl/weechat-perl.c15
2 files changed, 8 insertions, 18 deletions
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 7c0c386bb..0531ec0de 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -1278,9 +1278,7 @@ weechat_perl_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);
}
}
@@ -1305,9 +1303,7 @@ weechat_perl_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);
}
}
@@ -2979,8 +2975,7 @@ weechat_perl_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/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c
index c6b75fcc6..25e3efb93 100644
--- a/src/plugins/perl/weechat-perl.c
+++ b/src/plugins/perl/weechat-perl.c
@@ -709,8 +709,7 @@ weechat_perl_unload (struct t_plugin_script *script)
WEECHAT_SCRIPT_EXEC_INT,
script->shutdown_func,
NULL, NULL);
- if (rc)
- free (rc);
+ free (rc);
}
filename = strdup (script->filename);
@@ -736,14 +735,12 @@ weechat_perl_unload (struct t_plugin_script *script)
PERL_SET_CONTEXT (perl_current_script->interpreter);
}
#else
- if (interpreter)
- free (interpreter);
+ free (interpreter);
#endif /* MULTIPLICITY */
(void) weechat_hook_signal_send ("perl_script_unloaded",
WEECHAT_HOOK_SIGNAL_STRING, filename);
- if (filename)
- free (filename);
+ free (filename);
}
/*
@@ -859,8 +856,7 @@ weechat_perl_eval (struct t_gui_buffer *buffer, int send_to_buffer_as_input,
"script_perl_eval",
"s", func_argv);
/* result is ignored */
- if (result)
- free (result);
+ free (result);
weechat_perl_output_flush ();
@@ -966,8 +962,7 @@ weechat_perl_command_cb (const void *pointer, void *data,
ptr_name, 1);
weechat_perl_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)
{