diff --git a/source/modes/ssh.c b/source/modes/ssh.c index e613504d9..37590b843 100644 --- a/source/modes/ssh.c +++ b/source/modes/ssh.c @@ -494,7 +494,7 @@ static SshEntry *get_ssh(SSHModePrivateData *pd, unsigned int *length) { path = g_build_filename(cache_dir, SSH_CACHE_FILE, NULL); char **h = history_get_list(path, length); - retv = malloc((*length) * sizeof(SshEntry)); + retv = g_malloc0((*length) * sizeof(SshEntry)); for (unsigned int i = 0; i < (*length); i++) { int port = 0; char **ssplit = g_strsplit(h[i], "\x1F", -1); diff --git a/source/rofi.c b/source/rofi.c index f8fa1059b..f34051260 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -868,14 +868,14 @@ static gboolean startup(G_GNUC_UNUSED gpointer data) { if (g_strcmp0(msg, "-") == 0) { size_t index = 0, i = 0; size_t length = 1024; - msg = malloc(length * sizeof(char)); + msg = g_malloc(length * sizeof(char)); while ((i = fread(&msg[index], 1, 1024, stdin)) > 0) { index += i; length += i; if (length >= ROFI_MAX_DMENU_INPUT) { break; } - msg = realloc(msg, length * sizeof(char)); + msg = g_realloc(msg, length * sizeof(char)); } msg[index] = 0;