diff options
Diffstat (limited to 'dix/property.c')
-rw-r--r-- | dix/property.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/dix/property.c b/dix/property.c index acce94b2c..f7f9d0943 100644 --- a/dix/property.c +++ b/dix/property.c @@ -276,11 +276,13 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, if (!pProp) return BadAlloc; data = malloc(totalSize); - if (!data && len) { - dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY); - return BadAlloc; + if (totalSize) { + if (!data) { + dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY); + return BadAlloc; + } + memcpy(data, value, totalSize); } - memcpy(data, value, totalSize); pProp->propertyName = property; pProp->type = type; pProp->format = format; @@ -313,9 +315,11 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, if (mode == PropModeReplace) { data = malloc(totalSize); - if (!data && len) - return BadAlloc; - memcpy(data, value, totalSize); + if (totalSize) { + if (!data) + return BadAlloc; + memcpy(data, value, totalSize); + } pProp->data = data; pProp->size = len; pProp->type = type; |