Fix dangling pointers causing erratic timer behaviour (affects taskbar with spacing); use calloc instead of malloc for safer initializations

git-svn-id: http://tint2.googlecode.com/svn/trunk@758 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
o9000
2015-04-17 20:17:25 +00:00
committed by mrovi9000@gmail.com
parent 778b9f0ebf
commit 66cae4bb7c
17 changed files with 135 additions and 123 deletions

View File

@@ -235,14 +235,14 @@ static XSettingsList *parse_settings (unsigned char *data, size_t len)
goto out;
}
setting = malloc (sizeof *setting);
setting = calloc (1, sizeof *setting);
if (!setting) {
result = XSETTINGS_NO_MEM;
goto out;
}
setting->type = XSETTINGS_TYPE_INT; /* No allocated memory */
setting->name = malloc (name_len + 1);
setting->name = calloc (name_len + 1, 1);
if (!setting->name) {
result = XSETTINGS_NO_MEM;
goto out;
@@ -276,7 +276,7 @@ static XSettingsList *parse_settings (unsigned char *data, size_t len)
goto out;
}
setting->data.v_string = malloc (v_int + 1);
setting->data.v_string = calloc (v_int + 1, 1);
if (!setting->data.v_string) {
result = XSETTINGS_NO_MEM;
goto out;
@@ -400,7 +400,7 @@ XSettingsClient *xsettings_client_new (Display *display, int screen, XSettingsNo
{
XSettingsClient *client;
client = malloc (sizeof *client);
client = calloc (1, sizeof *client);
if (!client)
return NULL;