Fix a memory leak in update-all-ucodes. Print a status summary to the user if, when chosing to update all devices to the latest microcode level using the ncurses interface, all devices are update which says "All devices up to date"
Signed-off-by: Brian King <brk...@linux.vnet.ibm.com> --- iprconfig.c | 26 ++++++++++++++++++-------- iprconfig.h | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff -puN iprconfig.c~iprutils_update_all_ucodes_fixes iprconfig.c --- iprutils.patch/iprconfig.c~iprutils_update_all_ucodes_fixes 2015-09-16 15:51:55.413526784 -0500 +++ iprutils.patch-bjking1/iprconfig.c 2015-11-03 21:09:51.082669361 -0600 @@ -11544,11 +11544,12 @@ int download_all_ucode(i_container *i_co struct ipr_ioa *ioa; struct ipr_dev *dev; struct ipr_fw_images *lfw; - struct screen_output *s_out; + struct screen_output *s_out = NULL; struct download_ucode_elem *elem, *update_list = NULL; int header_lines; char line[BUFSIZ]; char *body; + int rc = RC_93_All_Up_To_Date; processing(); i_con = free_i_con(i_con); @@ -11564,11 +11565,15 @@ int download_all_ucode(i_container *i_co continue; lfw = get_latest_fw_image(dev); - if (!lfw || lfw->version <= get_fw_version(dev)) + if (!lfw || lfw->version <= get_fw_version(dev)) { + free(lfw); continue; + } - if (ioa->is_secondary) + if (ioa->is_secondary) { + free(lfw); continue; + } sprintf(line, "%-6s %-10X %-10s %s\n", basename(dev->gen_name), lfw->version, @@ -11585,22 +11590,27 @@ int download_all_ucode(i_container *i_co } } - n_confirm_download_all_ucode.body = body; - s_out = screen_driver(&n_confirm_download_all_ucode, header_lines, i_con); + if (update_list) { + n_confirm_download_all_ucode.body = body; + s_out = screen_driver(&n_confirm_download_all_ucode, header_lines, i_con); + } - if (s_out && s_out->rc != CANCEL_FLAG) { + if (!s_out || s_out->rc != CANCEL_FLAG) { while (update_list) { elem = update_list; update_list = elem->next; update_ucode(elem->dev, elem->lfw); + free(elem->lfw); free(elem); } } - if (s_out) + if (s_out) { + rc = s_out->rc; free(s_out); + } - return 0; + return rc; } /** diff -puN iprconfig.h~iprutils_update_all_ucodes_fixes iprconfig.h --- iprutils.patch/iprconfig.h~iprutils_update_all_ucodes_fixes 2015-09-16 15:51:58.309500304 -0500 +++ iprutils.patch-bjking1/iprconfig.h 2015-09-16 16:00:46.626731409 -0500 @@ -1684,6 +1684,7 @@ const char *screen_status[] = { /* 90 */ __("Selected disk enclosure is in Unknown state. Please check your hardware support"), /* 91 */ __("Create disk array failed - can not mix 5XX and 4K disks."), /* 92 */ __("Create disk array failed - can not build with read intensive disks only."), + /* 93 */ __("All devices up to date"), /* NOTE: 127 maximum limit */ }; @@ -1783,6 +1784,7 @@ enum { RC_90_Enclosure_Is_Unknown, RC_91_Mixed_Logical_Blk_Size, RC_92_UNSUPT_REQ_BLK_DEV_CLASS, + RC_93_All_Up_To_Date, /* NOTE: 127 maximum limit */ }; _ -- Brian King Power Linux I/O IBM Linux Technology Center ------------------------------------------------------------------------------ _______________________________________________ Iprdd-devel mailing list Iprdd-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iprdd-devel