From: lixiaokeng Subject: [PATCH V4 02/14] libmultipath: change malloc to calloc in print_foreign_topology Date: Thu, 10 Sep 2020 18:47:34 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Content-Language: en-GB To: Christophe Varoqui , Martin Wilck , Benjamin Marzinski , dm-devel mailing list Cc: linfeilong , "liuzhiqiang (I)" List-Id: dm-devel.ids We chanege malloc to calloc. Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/foreign.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/foreign.c b/libmultipath/foreign.c index e8f61351..fce19347 100644 --- a/libmultipath/foreign.c +++ b/libmultipath/foreign.c @@ -544,8 +544,8 @@ void print_foreign_topology(int verbosity) int buflen = MAX_LINE_LEN * MAX_LINES; char *buf = NULL, *tmp = NULL; - buf = malloc(buflen); - buf[0] = '\0'; + buf = calloc(1, buflen); + while (buf != NULL) { char *c = buf; --