From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.88.87] (unknown [180.246.147.8]) by gnuweeb.org (Postfix) with ESMTPSA id CFD8C7E787; Tue, 26 Apr 2022 21:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1651008294; bh=MdNIKPfR4zKWtL86DFAR0CP47IGlur35JdxQ4ssDWjo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GurIlntysA5KodH8idSDBgIBMst5A+qTVGUOtQTLP+2svE2FkegYjljHLPbG/OzcJ Y6dAyf4oCao+DwGbSIFHT5e26UZJFWKg+b8/Tq/ZvKo+3PAUkPR8XuPKidrEttfaMc AayKVBASbKHjsSbRVZ00wkCVS7baXxWKDuwhupOlfPJWJeFq+pS2mrjKLvR78x1A4X +/iMEgH82iOskaqTiLgCnhmUiLkeD95aHIUk5aYt/ospx+GhNfhwRn+24QCih8iGhe MWCij1e2GWCXQKYWgmlv98GUrlyYB2ZQ9l7x359wco2q53uUSYGpiLiCYoOf49vymB Om0KE+lMPYuRg== Message-ID: Date: Wed, 27 Apr 2022 04:24:44 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v1 3/6] stat: Handle `ENOMEM` case on `malloc()` call Content-Language: en-US To: Jens Axboe Cc: fio Mailing List , GNU/Weeb Mailing List References: <20220426212044.78898-1-ammarfaizi2@gnuweeb.org> <20220426212044.78898-4-ammarfaizi2@gnuweeb.org> From: Ammar Faizi In-Reply-To: <20220426212044.78898-4-ammarfaizi2@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: On 4/27/22 4:20 AM, Ammar Faizi wrote: > threadstats = malloc(nr_ts * sizeof(struct thread_stat)); > + if (!threadstats) { > + log_err("fio: failed to allocate threadstats\n"); > + return; > + } > + > opt_lists = malloc(nr_ts * sizeof(struct flist_head *)); > + if (!opt_lists) { > + log_err("fio: failed to allocate opt_lists\n"); I should free(threadstats) here, will send v2 soon. > + return; > + } > > for (i = 0; i < nr_ts; i++) { > init_thread_stat(&threadstats[i]); -- Ammar Faizi