From: Andre Noll Date: Thu, 17 Mar 2022 19:36:06 +0000 (+0100) Subject: afs.c: Improve documentation of activate_mood_or_playlist(). X-Git-Tag: v0.7.1~26 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=425bd709b2df8dc2754678ca28c91b1534d26078 afs.c: Improve documentation of activate_mood_or_playlist(). It is not obvious when arg and current_mop can alias each other so add an explanatory comment. --- diff --git a/afs.c b/afs.c index 031a0099..522615a3 100644 --- a/afs.c +++ b/afs.c @@ -481,6 +481,12 @@ static int activate_mood_or_playlist(const char *arg, int *num_admissible, if (num_admissible) *num_admissible = ret; current_play_mode = mode; + /* + * We get called with arg == current_mop from the signal dispatcher + * after SIGHUP and from the error path of the select command to + * re-select the current mood or playlist. In this case the assignment + * to current_mop below would result in a use-after-free condition. + */ if (arg != current_mop) { free(current_mop); if (arg) {