diff --git a/libdrgn/program.c b/libdrgn/program.c index b00d09495..dca7697a3 100644 --- a/libdrgn/program.c +++ b/libdrgn/program.c @@ -666,6 +666,8 @@ struct drgn_error *drgn_program_cache_thread(struct drgn_program *prog, if (err) return err; struct drgn_thread *thread = malloc(sizeof(struct drgn_thread)); + if (!thread) + return &drgn_enomem; *thread = (struct drgn_thread){ .tid = entry.key, .prstatus = { data, size } }; if (drgn_thread_map_size(&prog->thread_map) == 0) { // Having perused the GDB, BFD, and Kernel source code, it appears that