diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-command.c | 2 | ||||
-rw-r--r-- | src/core/wee-input.c | 4 | ||||
-rw-r--r-- | src/core/wee-log.c | 2 | ||||
-rw-r--r-- | src/core/wee-string.c | 10 | ||||
-rw-r--r-- | src/core/wee-upgrade.c | 2 | ||||
-rw-r--r-- | src/core/wee-util.c | 6 |
6 files changed, 13 insertions, 13 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index febc05c52..65cedc6a1 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -363,7 +363,7 @@ command_builtin (void *data, struct t_gui_buffer *buffer, else { length = strlen (argv_eol[1]) + 2; - command = (char *)malloc (length); + command = (char *)malloc (length * sizeof (char)); if (command) { snprintf (command, length, "/%s", argv_eol[1]); diff --git a/src/core/wee-input.c b/src/core/wee-input.c index 8bf118294..ed1c34587 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -126,9 +126,9 @@ input_exec_command (struct t_gui_buffer *buffer, char *string, /*if (cfg_irc_send_unknown_commands) { if (ptr_args) - unknown_command = (char *)malloc (strlen (command + 1) + 1 + strlen (ptr_args) + 1); + unknown_command = (char *)malloc ((strlen (command + 1) + 1 + strlen (ptr_args) + 1) * sizeof (char)); else - unknown_command = (char *)malloc (strlen (command + 1) + 1); + unknown_command = (char *)malloc ((strlen (command + 1) + 1) * sizeof (char)); if (unknown_command) { diff --git a/src/core/wee-log.c b/src/core/wee-log.c index 9dc0ced15..e7229797e 100644 --- a/src/core/wee-log.c +++ b/src/core/wee-log.c @@ -204,7 +204,7 @@ log_crash_rename () log_close (); length = strlen (weechat_home) + 128; - new_name = (char *)malloc (length); + new_name = (char *)malloc (length * sizeof (char)); if (new_name) { time_now = time (NULL); diff --git a/src/core/wee-string.c b/src/core/wee-string.c index b1728d578..0fdd4d2eb 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -59,7 +59,7 @@ string_strndup (char *string, int length) if ((int)strlen (string) < length) return strdup (string); - result = (char *)malloc (length + 1); + result = (char *)malloc ((length + 1) * sizeof (char)); if (!result) return NULL; @@ -353,7 +353,7 @@ string_convert_hex_chars (char *string) int pos_output; long number; - output = (char *)malloc (strlen (string) + 1); + output = (char *)malloc ((strlen (string) + 1) * sizeof (char)); if (output) { pos_output = 0; @@ -547,11 +547,11 @@ string_split_command (char *command, char separator) ptr = ++p; } - array = (char **)malloc ((nb_substr + 1) * sizeof(char *)); + array = (char **)malloc ((nb_substr + 1) * sizeof (char *)); if (!array) return NULL; - buffer = (char *)malloc ( (strlen(command) + 1) * sizeof (char)); + buffer = (char *)malloc ((strlen(command) + 1) * sizeof (char)); if (!buffer) { free (array); @@ -652,7 +652,7 @@ string_iconv (int from_utf8, char *from_code, char *to_code, char *string) ptr_inbuf = inbuf; inbytesleft = strlen (inbuf); outbytesleft = inbytesleft * 4; - outbuf = (char *)malloc (outbytesleft + 2); + outbuf = (char *)malloc ((outbytesleft + 2) * sizeof (char)); ptr_outbuf = outbuf; ptr_inbuf_shift = NULL; done = 0; diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 8c7b1bee2..4f9419860 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -600,7 +600,7 @@ session_read_str (FILE *file, char **string) if (string) { - (*string) = (char *)malloc (length + 1); + (*string) = (char *)malloc ((length + 1) * sizeof (char)); if (!(*string)) return 0; diff --git a/src/core/wee-util.c b/src/core/wee-util.c index 40b8ca4cc..dec328343 100644 --- a/src/core/wee-util.c +++ b/src/core/wee-util.c @@ -220,7 +220,7 @@ util_search_full_lib_name (char *filename, char *sys_directory) if (CONFIG_STRING(config_plugins_extension) && CONFIG_STRING(config_plugins_extension)[0]) length += strlen (CONFIG_STRING(config_plugins_extension)); - name_with_ext = (char *)malloc (length); + name_with_ext = (char *)malloc (length * sizeof (char)); if (!name_with_ext) return strdup (filename); strcpy (name_with_ext, filename); @@ -232,7 +232,7 @@ util_search_full_lib_name (char *filename, char *sys_directory) /* try WeeChat user's dir */ length = strlen (weechat_home) + strlen (name_with_ext) + strlen (sys_directory) + 16; - final_name = (char *)malloc (length); + final_name = (char *)malloc (length * sizeof (char)); if (!final_name) { free (name_with_ext); @@ -250,7 +250,7 @@ util_search_full_lib_name (char *filename, char *sys_directory) /* try WeeChat global lib dir */ length = strlen (WEECHAT_LIBDIR) + strlen (name_with_ext) + strlen (sys_directory) + 16; - final_name = (char *)malloc (length); + final_name = (char *)malloc (length * sizeof (char)); if (!final_name) { free (name_with_ext); |