diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-07-19 09:33:21 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-12-08 10:06:42 -0800 |
commit | 76850471b4a5a6d30f5660234e87ec2772e7b426 (patch) | |
tree | c6f119065f359f3b286a8220163808b291ce31d4 | |
parent | 8a62e26515e528bb47917ec4a55cc2b492419eeb (diff) |
Convert src/xcms to use reallocarray()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/xcms/CvCols.c | 3 | ||||
-rw-r--r-- | src/xcms/StCols.c | 3 | ||||
-rw-r--r-- | src/xcms/cmsInt.c | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/xcms/CvCols.c b/src/xcms/CvCols.c index 87d49311..0be77601 100644 --- a/src/xcms/CvCols.c +++ b/src/xcms/CvCols.c @@ -39,6 +39,7 @@ #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" +#include "reallocarray.h" /* * LOCAL DEFINES @@ -796,7 +797,7 @@ XcmsConvertColors( * Make copy of array of color specifications */ if (nColors > 1) { - pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); + pColors_tmp = Xmallocarray(nColors, sizeof(XcmsColor)); } else { pColors_tmp = &Color1; } diff --git a/src/xcms/StCols.c b/src/xcms/StCols.c index 42a29cd7..f3df8ed0 100644 --- a/src/xcms/StCols.c +++ b/src/xcms/StCols.c @@ -38,6 +38,7 @@ #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" +#include "reallocarray.h" /************************************************************************ @@ -85,7 +86,7 @@ XcmsStoreColors( * overwrite the contents. */ if (nColors > 1) { - pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); + pColors_tmp = Xmallocarray(nColors, sizeof(XcmsColor)); } else { pColors_tmp = &Color1; } diff --git a/src/xcms/cmsInt.c b/src/xcms/cmsInt.c index f4aef04f..83be2627 100644 --- a/src/xcms/cmsInt.c +++ b/src/xcms/cmsInt.c @@ -41,6 +41,7 @@ #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" +#include "reallocarray.h" #ifndef XCMSCOMPPROC # define XCMSCOMPPROC XcmsTekHVCClipC @@ -82,7 +83,7 @@ _XcmsCopyPointerArray( for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); n++; /* add 1 to include the NULL pointer */ - if ((newArray = Xmalloc(n * sizeof(XPointer)))) { + if ((newArray = Xmallocarray(n, sizeof(XPointer)))) { memcpy((char *)newArray, (char *)pap, (unsigned)(n * sizeof(XPointer))); } @@ -141,7 +142,7 @@ _XcmsPushPointerArray( /* add 2: 1 for the new pointer and another for the NULL pointer */ n += 2; - if ((newArray = Xmalloc(n * sizeof(XPointer)))) { + if ((newArray = Xmallocarray(n, sizeof(XPointer)))) { memcpy((char *)(newArray+1),(char *)pap, (unsigned)((n-1) * sizeof(XPointer))); *newArray = p; |