diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 4e0086d04..311489a0b 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -76,9 +76,7 @@ ephyrInitialize(KdCardInfo * card, EphyrPriv * priv) Bool ephyrCardInit(KdCardInfo * card) { - EphyrPriv *priv; - - priv = (EphyrPriv *) malloc(sizeof(EphyrPriv)); + EphyrPriv *priv = calloc(1, sizeof(EphyrPriv)); if (!priv) return FALSE; diff --git a/hw/kdrive/ephyr/ephyr_glamor.c b/hw/kdrive/ephyr/ephyr_glamor.c index 772b73052..5573327f0 100644 --- a/hw/kdrive/ephyr/ephyr_glamor.c +++ b/hw/kdrive/ephyr/ephyr_glamor.c @@ -144,11 +144,10 @@ ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs) glLinkProgram(prog); glGetProgramiv(prog, GL_LINK_STATUS, &ok); if (!ok) { - GLchar *info; GLint size; glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); - info = malloc(size); + GLchar *info = calloc(1, size); glGetProgramInfoLog(prog, size, NULL, info); ErrorF("Failed to link: %s\n", info); @@ -352,7 +351,7 @@ ephyr_glamor_screen_init(xcb_window_t win, xcb_visualid_t vid) glamor = calloc(1, sizeof(struct ephyr_glamor)); if (!glamor) { - FatalError("malloc"); + FatalError("calloc"); return NULL; } diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index f1d6a0a81..7fcca5ce0 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -533,7 +533,6 @@ hostx_init(void) uint32_t pixel; int index; char *tmpstr; - char *class_hint; size_t class_len; xcb_screen_t *xscreen; xcb_rectangle_t rect = { 0, 0, 1, 1 }; @@ -658,7 +657,7 @@ hostx_init(void) if (tmpstr && (!ephyrResNameFromCmd)) ephyrResName = tmpstr; class_len = strlen(ephyrResName) + 1 + strlen("Xephyr") + 1; - class_hint = malloc(class_len); + char *class_hint = calloc(1, class_len); if (class_hint) { strcpy(class_hint, ephyrResName); strcpy(class_hint + strlen(ephyrResName) + 1, "Xephyr"); diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c index 1e0366be2..2dea819a5 100644 --- a/hw/kdrive/src/kxv.c +++ b/hw/kdrive/src/kxv.c @@ -135,7 +135,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num) KdXvScreenKey = XvGetScreenKey(); PortResource = XvGetRTPort(); - ScreenPriv = malloc(sizeof(KdXVScreenRec)); + ScreenPriv = calloc(1, sizeof(KdXVScreenRec)); dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv); if (!ScreenPriv) @@ -723,7 +723,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) } if (!winPriv) { - winPriv = malloc(sizeof(KdXVWindowRec)); + winPriv = calloc(1, sizeof(KdXVWindowRec)); if (!winPriv) return BadAlloc; winPriv->PortRec = portPriv;