summaryrefslogtreecommitdiff
path: root/Xi/xiproperty.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-03-21 13:42:12 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-04-21 16:57:08 -0700
commit1c56ac63c040280498c4a9d67b48c35b60070821 (patch)
treeab1073d348cb1acf0523ede3e1f2fa73f3b5fdb6 /Xi/xiproperty.c
parentb9e665c8b2f048feb3064ce412e0b3e9eb6797b0 (diff)
downloadxserver-1c56ac63c040280498c4a9d67b48c35b60070821.tar.gz
Convert top level extensions to new *allocarray functions
v2: remove now useless parentheses Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'Xi/xiproperty.c')
-rw-r--r--Xi/xiproperty.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 8e8e4b061..e3b8f5abe 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -221,7 +221,7 @@ list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
if (nprops) {
Atom *a;
- atoms = malloc(nprops * sizeof(Atom));
+ atoms = xallocarray(nprops, sizeof(Atom));
if (!atoms)
return BadAlloc;
a = atoms;
@@ -687,7 +687,6 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
{
XIPropertyPtr prop;
int size_in_bytes;
- int total_size;
unsigned long total_len;
XIPropertyValuePtr prop_value;
XIPropertyValueRec new_value;
@@ -725,9 +724,8 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
if (mode == PropModeReplace || len > 0) {
void *new_data = NULL, *old_data = NULL;
- total_size = total_len * size_in_bytes;
- new_value.data = (void *) malloc(total_size);
- if (!new_value.data && total_size) {
+ new_value.data = xallocarray(total_len, size_in_bytes);
+ if (!new_value.data && total_len && size_in_bytes) {
if (add)
XIDestroyDeviceProperty(prop);
return BadAlloc;