@@ -1049,6 +1049,10 @@ CC_HINT(hot) rlm_rcode_t unlang_interpret(request_t *request, bool running)
10491049
10501050 /*
10511051 * Close out the section we entered earlier
1052+ *
1053+ * @todo - this arguably accesses the
1054+ * frame after it's been popped, but this
1055+ * is usually OK. :(
10521056 */
10531057 instruction_done_debug (request , frame , frame -> instruction );
10541058
@@ -1738,7 +1742,7 @@ static xlat_action_t unlang_cancel_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
17381742 fr_value_box_t * vb ;
17391743 fr_time_t when = fr_time_from_sec (0 ); /* Invalid clang complaints if we don't set this */
17401744
1741- fr_assert (unlang_interpret_event_list ( request ) != NULL );
1745+ fr_assert (el != NULL );
17421746
17431747 XLAT_ARGS (args , & timeout );
17441748
@@ -1761,7 +1765,7 @@ static xlat_action_t unlang_cancel_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
17611765 */
17621766 ev_p = ev_p_og = request_data_get (request , (void * )unlang_cancel_xlat , 0 );
17631767 if (ev_p ) {
1764- MEM (* ev_p );
1768+ fr_assert (* ev_p );
17651769
17661770 when = fr_timer_when (* ev_p );
17671771 } else {
@@ -1855,10 +1859,7 @@ static xlat_action_t unlang_interpret_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
18551859 /*
18561860 * Nothing there...
18571861 */
1858- if (!instruction ) {
1859- talloc_free (vb );
1860- return XLAT_ACTION_DONE ;
1861- }
1862+ if (!instruction ) goto clear ;
18621863
18631864 /*
18641865 * How deep the current stack is.
@@ -1872,6 +1873,8 @@ static xlat_action_t unlang_interpret_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
18721873 * The current module
18731874 */
18741875 if (strcmp (fmt , "module" ) == 0 ) {
1876+ if (!request -> module ) goto clear ;
1877+
18751878 if (fr_value_box_strdup (vb , vb , NULL , request -> module , false) < 0 ) goto error ;
18761879
18771880 goto finish ;
@@ -1881,6 +1884,8 @@ static xlat_action_t unlang_interpret_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
18811884 * Name of the instruction.
18821885 */
18831886 if (strcmp (fmt , "name" ) == 0 ) {
1887+ if (!instruction -> name ) goto clear ;
1888+
18841889 if (fr_value_box_bstrndup (vb , vb , NULL , instruction -> name ,
18851890 strlen (instruction -> name ), false) < 0 ) goto error ;
18861891 goto finish ;
@@ -1890,6 +1895,8 @@ static xlat_action_t unlang_interpret_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
18901895 * The request processing stage.
18911896 */
18921897 if (strcmp (fmt , "processing_stage" ) == 0 ) {
1898+ if (!request -> component ) goto clear ;
1899+
18931900 if (fr_value_box_strdup (vb , vb , NULL , request -> component , false) < 0 ) goto error ;
18941901
18951902 goto finish ;
@@ -1972,6 +1979,7 @@ static xlat_action_t unlang_interpret_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
19721979 if (vb -> type != FR_TYPE_NULL ) {
19731980 fr_dcursor_append (out , vb );
19741981 } else {
1982+ clear :
19751983 talloc_free (vb );
19761984 }
19771985
0 commit comments