The work struct pointer in struct pc_data in findnonce is never freed yet there is no need to allocate it separately so make struct work a static part of the struct pc_data. s