Re: [PATCH v1 3/6] stat: Handle `ENOMEM` case on `malloc()` call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux