From nobody Mon May 20 21:40:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=bt.com ARC-Seal: i=1; a=rsa-sha256; t=1559918856; cv=none; d=zoho.com; s=zohoarc; b=UTrweR14Fof5+5BotS7+mg0pegPJvCxNPCQ8VEXoGysmAosfaTMFhGvPDVopiQYWuvyawUGvymibK0NweZrUSGS8A5rdvuXFhbewFNICURQG7AURJ8Pl1d74xVXirMlxNIcK3uj1PC50sfT0e+rcgUjpWJq9HvOUQwC14/cpaMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559918856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=Fe6+ipjgPWXSRzIMJhSouIMAUOhHaX8oco1z7ZcxnWI=; b=N98uaINl9aLAp8l+EvUcmA91RbWDz00pqPNAXhMPBmK+xRXYVeYL4iPPd1iJfXdzOK+8LWGsv19BxE1kyw6J1JwWfcwzo4koky4uGg6YPO2RVwiwsK4UTPwAKwvY0pmTl3X/WbUj0zhHB8HAJ0OpgF+moLvJRElcSJqmHmnCNjo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155991885646690.3354506712376; Fri, 7 Jun 2019 07:47:36 -0700 (PDT) Received: from localhost ([::1]:48410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZG9S-0007UY-GB for importer@patchew.org; Fri, 07 Jun 2019 10:47:30 -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] Content-Transfer-Encoding: quoted-printable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Due to memory management rules. See HACKING. =20 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 =3D=3D ' ') { end++; } - in =3D strndup(tail, end - tail); + in =3D g_strndup(tail, end - tail); str =3D 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, } =20 if (end) - *val =3D strndup(start, end - start); + *val =3D g_strndup(start, end - start); else *val =3D strdup(start); return 1;