mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 22:03:01 +00:00 
			
		
		
		
	fix: use after free for cmd in mympd_callback
This commit is contained in:
		| @@ -379,10 +379,8 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg) | |||||||
|             n = mympd_get_stats(mpd.buf); |             n = mympd_get_stats(mpd.buf); | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|     free(cmd); |  | ||||||
|  |  | ||||||
|     if (mpd.conn_state == MPD_CONNECTED && mpd_connection_get_error(mpd.conn) != MPD_ERROR_SUCCESS) |     if (mpd.conn_state == MPD_CONNECTED && mpd_connection_get_error(mpd.conn) != MPD_ERROR_SUCCESS) { | ||||||
|     { |  | ||||||
|         #ifdef DEBUG |         #ifdef DEBUG | ||||||
|         fprintf(stderr,"Error: %s\n", mpd_connection_get_error_message(mpd.conn)); |         fprintf(stderr,"Error: %s\n", mpd_connection_get_error_message(mpd.conn)); | ||||||
|         #endif |         #endif | ||||||
| @@ -409,6 +407,7 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg) | |||||||
|         #endif |         #endif | ||||||
|         mg_send_http_chunk(nc, mpd.buf, n); |         mg_send_http_chunk(nc, mpd.buf, n); | ||||||
|     } |     } | ||||||
|  |     free(cmd);     | ||||||
| } | } | ||||||
|  |  | ||||||
| int mympd_close_handler(struct mg_connection *c) { | int mympd_close_handler(struct mg_connection *c) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation