From patchwork Fri Jun 7 14:07:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 1112037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=bt.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45L6wd1ZVtz9sNR for ; Sat, 8 Jun 2019 02:11:43 +1000 (AEST) Received: from localhost ([::1]:48396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZG5t-0005LK-Bc for incoming@patchwork.ozlabs.org; Fri, 07 Jun 2019 10:43:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50867) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZFbf-0006xV-UE for qemu-devel@nongnu.org; Fri, 07 Jun 2019 10:12:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZFbe-0006X7-AR for qemu-devel@nongnu.org; Fri, 07 Jun 2019 10:12:35 -0400 Received: from smtpe1.intersmtp.com ([213.121.35.77]:29445) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZFbe-0006RB-1O; Fri, 07 Jun 2019 10:12:34 -0400 Received: from tpw09926dag18f.domain1.systemhost.net (10.9.212.26) by BWP09926082.bt.com (10.36.82.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1713.5; Fri, 7 Jun 2019 15:06:58 +0100 Received: from tpw09926dag18e.domain1.systemhost.net (10.9.212.18) by tpw09926dag18f.domain1.systemhost.net (10.9.212.26) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 7 Jun 2019 15:07:11 +0100 Received: from tpw09926dag18e.domain1.systemhost.net ([fe80::a946:6348:ccf4:fa6c]) by tpw09926dag18e.domain1.systemhost.net ([fe80::a946:6348:ccf4:fa6c%12]) with mapi id 15.00.1395.000; Fri, 7 Jun 2019 15:07:11 +0100 From: To: Thread-Topic: [Qemu-trivial] [PATCH] test: Use g_strndup instead of plain strndup Thread-Index: AQHVHTpMtEQE4swKekybGdM8Y3P6xw== Date: Fri, 7 Jun 2019 14:07:11 +0000 Message-ID: <430a9a42f7a34b799ee4d2f3d7ab2e23@tpw09926dag18e.domain1.systemhost.net> Accept-Language: en-AU, en-GB, en-US Content-Language: en-AU X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.187.101.40] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 213.121.35.77 Subject: [Qemu-devel] [Qemu-trivial] [PATCH] test: Use g_strndup instead of plain strndup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Due to memory management rules. See HACKING. Signed-off-by: Tony Nguyen diff --git a/tests/check-qjson.c b/tests/check-qjson.c index fa2afcc..07a773e 100644 --- a/tests/check-qjson.c +++ b/tests/check-qjson.c @@ -767,7 +767,7 @@ static void utf8_string(void) if (*end == ' ') { end++; } - in = strndup(tail, end - tail); + in = g_strndup(tail, end - tail); str = from_json_str(in, j, NULL); g_assert(!str); g_free(in); diff --git a/tests/migration/stress.c b/tests/migration/stress.c index 49a03aa..72c4012 100644 --- a/tests/migration/stress.c +++ b/tests/migration/stress.c @@ -104,7 +104,7 @@ static int get_command_arg_str(const char *name, } if (end) - *val = strndup(start, end - start); + *val = g_strndup(start, end - start); else *val = strdup(start); return 1;