@@ -431,6 +431,7 @@ void init_menu_system_values(){
431431 volume_percentage = 50 ; // /wrong value: setting default to 50
432432 }
433433 else {
434+ pclose (fp);
434435 fgets (res, sizeof (res)-1 , fp);
435436
436437 // / Check if Volume is a number (at least the first char)
@@ -451,6 +452,7 @@ void init_menu_system_values(){
451452 brightness_percentage = 50 ; // /wrong value: setting default to 50
452453 }
453454 else {
455+ pclose (fp);
454456 fgets (res, sizeof (res)-1 , fp);
455457
456458 // / Check if brightness is a number (at least the first char)
@@ -702,7 +704,10 @@ void run_menu_loop()
702704 RES_HW_SCREEN_HORIZONTAL * RES_HW_SCREEN_VERTICAL * sizeof(uint16_t));*/
703705
704706 /* Stop Ampli */
705- popen (SHELL_CMD_TURN_AMPLI_OFF, " r" );
707+ fp = popen (SHELL_CMD_TURN_AMPLI_OFF, " r" );
708+ if (fp != NULL ) {
709+ pclose (fp);
710+ }
706711
707712 // / -------- Main loop ---------
708713 while (!stop_menu_loop)
@@ -780,7 +785,9 @@ void run_menu_loop()
780785 fp = popen (shell_cmd, " r" );
781786 if (fp == NULL ) {
782787 MENU_ERROR_PRINTF (" Failed to run command %s\n " , shell_cmd);
783- }
788+ } else {
789+ pclose (fp);
790+ }
784791
785792 // / ------ Refresh screen ------
786793 screen_refresh = 1 ;
@@ -796,6 +803,8 @@ void run_menu_loop()
796803 fp = popen (shell_cmd, " r" );
797804 if (fp == NULL ) {
798805 MENU_ERROR_PRINTF (" Failed to run command %s\n " , shell_cmd);
806+ } else {
807+ pclose (fp);
799808 }
800809 // / ------ Refresh screen ------
801810 screen_refresh = 1 ;
@@ -856,6 +865,8 @@ void run_menu_loop()
856865 fp = popen (shell_cmd, " r" );
857866 if (fp == NULL ) {
858867 MENU_ERROR_PRINTF (" Failed to run command %s\n " , shell_cmd);
868+ } else {
869+ pclose (fp);
859870 }
860871 // / ------ Refresh screen ------
861872 screen_refresh = 1 ;
@@ -871,6 +882,8 @@ void run_menu_loop()
871882 fp = popen (shell_cmd, " r" );
872883 if (fp == NULL ) {
873884 MENU_ERROR_PRINTF (" Failed to run command %s\n " , shell_cmd);
885+ } else {
886+ pclose (fp);
874887 }
875888 // / ------ Refresh screen ------
876889 screen_refresh = 1 ;
@@ -932,6 +945,8 @@ void run_menu_loop()
932945 fp = popen (shell_cmd, " r" );
933946 if (fp == NULL ) {
934947 MENU_ERROR_PRINTF (" Failed to run command %s\n " , shell_cmd);
948+ } else {
949+ pclose (fp);
935950 }
936951
937952 stop_menu_loop = 1 ;
@@ -969,6 +984,8 @@ void run_menu_loop()
969984 fp = popen (shell_cmd, " r" );
970985 if (fp == NULL ) {
971986 MENU_ERROR_PRINTF (" Failed to run command %s\n " , shell_cmd);
987+ } else {
988+ pclose (fp);
972989 }
973990
974991 stop_menu_loop = 1 ;
@@ -1069,7 +1086,10 @@ void run_menu_loop()
10691086 }
10701087
10711088 /* Start Ampli */
1072- popen (SHELL_CMD_TURN_AMPLI_ON, " r" );
1089+ fp = popen (SHELL_CMD_TURN_AMPLI_ON, " r" );
1090+ if (fp != NULL ) {
1091+ pclose (fp);
1092+ }
10731093
10741094 // / ------ Reset last screen ------
10751095 SDL_BlitSurface (backup_hw_screen, NULL , hw_screen, NULL );
@@ -1097,9 +1117,13 @@ int launch_resume_menu_loop()
10971117 uint8_t menu_confirmation = 0 ;
10981118 int option_idx=RESUME_YES;
10991119 pumpWrap_disabled = 1 ;
1120+ FILE *fp;
11001121
11011122 /* Stop Ampli */
1102- popen (SHELL_CMD_TURN_AMPLI_OFF, " r" );
1123+ fp = popen (SHELL_CMD_TURN_AMPLI_OFF, " r" );
1124+ if (fp != NULL ) {
1125+ pclose (fp);
1126+ }
11031127
11041128 /* Save prev key repeat params and set new Key repeat */
11051129 SDL_GetKeyRepeat (&backup_key_repeat_delay, &backup_key_repeat_interval);
@@ -1273,7 +1297,10 @@ int launch_resume_menu_loop()
12731297 pumpWrap_disabled = 0 ;
12741298
12751299 /* Start Ampli */
1276- popen (SHELL_CMD_TURN_AMPLI_ON, " r" );
1300+ fp = popen (SHELL_CMD_TURN_AMPLI_ON, " r" );
1301+ if (fp != NULL ) {
1302+ pclose (fp);
1303+ }
12771304
12781305 return option_idx;
12791306}
0 commit comments