projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
70a7516
)
Add a check avoid segfault
author
Jianpeng Ma
<majianpeng@gmail.com>
Fri, 11 Jan 2013 07:52:55 +0000
(08:52 +0100)
committer
Jens Axboe
<axboe@kernel.dk>
Fri, 11 Jan 2013 07:52:55 +0000
(08:52 +0100)
If new_size was zero or realloc failed, it would be segment fault.
So add a check.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c
patch
|
blob
|
blame
|
history
diff --git
a/filesetup.c
b/filesetup.c
index 69eb37cd70ea9192606cc6bd4226f09f68216621..ab5cc48da71ddb317bab84109eb1845b9a7818e5 100644
(file)
--- a/
filesetup.c
+++ b/
filesetup.c
@@
-1079,6
+1079,10
@@
int add_file(struct thread_data *td, const char *fname)
dprint(FD_FILE, "resize file array to %d files\n", new_size);
td->files = realloc(td->files, new_size * sizeof(f));
+ if (td->files == NULL) {
+ log_err("fio: realloc OOM\n");
+ assert(0);
+ }
td->files_size = new_size;
}
td->files[cur_files] = f;