From f1aa32a4a45cdce9994d0c8bbcf1c0860f892657 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 13 Jan 2014 11:44:21 +0900 Subject: [PATCH] Evas/cserve2: Use calloc instead of malloc This will silence some warnings from valgrind (and add some safety as well...) --- src/bin/evas/evas_cserve2_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c index 3b04245137..bc12fed505 100644 --- a/src/bin/evas/evas_cserve2_cache.c +++ b/src/bin/evas/evas_cserve2_cache.c @@ -1889,7 +1889,7 @@ _glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size) size += shmname_size + idxname_size; size += req->nanswer * 10 * sizeof(int); - response = malloc(size); + response = calloc(1, size); if (!response) return NULL; msg = (Msg_Font_Glyphs_Loaded *) response; buf = response + sizeof(Msg_Font_Glyphs_Loaded); @@ -1979,7 +1979,7 @@ _file_path_join(const char *path, const char *end) len = strlen(path); len += strlen(end); len += strlen(EVAS_PATH_SEPARATOR); - res = malloc(len + 1); + res = calloc(1, len + 1); if (!res) return NULL; strcpy(res, path); strcat(res, EVAS_PATH_SEPARATOR); @@ -2056,7 +2056,7 @@ _glyphs_load_request_prepare(Glyphs_Request *req) // Won't render more than this number of glyphs max = req->nglyphs - req->nanswer; - req->render = malloc(sizeof(*req->render) * max); + req->render = calloc(max, sizeof(*req->render)); for (i = req->current; i < req->nglyphs; i++) { -- 2.34.1