mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 05:43:01 +00:00 
			
		
		
		
	Fix: memory leaks reported by valingrid
This commit is contained in:
		| @@ -822,6 +822,7 @@ static void mpd_client_api(t_config *config, t_mpd_state *mpd_state, void *arg_r | |||||||
|                 len = mpd_client_search(config, mpd_state, buffer, p_charbuf1, p_charbuf2, p_charbuf3, uint_buf1); |                 len = mpd_client_search(config, mpd_state, buffer, p_charbuf1, p_charbuf2, p_charbuf3, uint_buf1); | ||||||
|                 free(p_charbuf1); |                 free(p_charbuf1); | ||||||
|                 free(p_charbuf2); |                 free(p_charbuf2); | ||||||
|  |                 free(p_charbuf3); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         case MPD_API_DATABASE_SEARCH_ADV: |         case MPD_API_DATABASE_SEARCH_ADV: | ||||||
| @@ -2656,6 +2657,7 @@ static int mpd_client_smartpls_put(t_config *config, char *buffer, const char *p | |||||||
|         len = json_printf(&out, "{type: error, data: %Q}}", "Unknown smart playlist type"); |         len = json_printf(&out, "{type: error, data: %Q}}", "Unknown smart playlist type"); | ||||||
|         printf("Unknown smart playlist type: %s\n", pl_file); |         printf("Unknown smart playlist type: %s\n", pl_file); | ||||||
|     } |     } | ||||||
|  |     free(content); | ||||||
|     return len; |     return len; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -275,13 +275,17 @@ static bool mympd_api_read_syscmds(t_config *config, t_mympd_state *mympd_state) | |||||||
|                 if (strncmp(ent->d_name, ".", 1) == 0) |                 if (strncmp(ent->d_name, ".", 1) == 0) | ||||||
|                     continue; |                     continue; | ||||||
|                 order = strtol(ent->d_name, &cmd, 10); |                 order = strtol(ent->d_name, &cmd, 10); | ||||||
|                 if (strcmp(cmd, "") != 0) |                 if (strcmp(cmd, "") != 0) { | ||||||
|                     list_push(&mympd_state->syscmd_list, strdup(cmd), order); |                     list_push(&mympd_state->syscmd_list, cmd, order); | ||||||
|  |                 } | ||||||
|  |                 else { | ||||||
|  |                     printf("ERROR: Can't read syscmd file %s\n", ent->d_name); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|             closedir(dir); |             closedir(dir); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             printf("ERROR: Can't read syscmds"); |             printf("ERROR: Can't read syscmds\n"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation