@@ -327,6 +327,13 @@ void av_expr_free(AVExpr *e)
av_freep(&e);
}
+void av_expr_freep(AVExpr **e)
+{
+ if(!e) return;
+ av_expr_free(*e);
+ *e = NULL;
+}
+
static int parse_primary(AVExpr **e, Parser *p)
{
AVExpr *d = av_mallocz(sizeof(AVExpr));
@@ -92,6 +92,12 @@ double av_expr_eval(AVExpr *e, const double *const_values, void *opaque);
void av_expr_free(AVExpr *e);
/**
+ * Free a parsed expression previously created with av_expr_parse() and NULL its
+ * pointer.
+ */
+void av_expr_freep(AVExpr **e);
+
+/**
* Parse the string in numstr and return its value as a double. If
* the string is empty, contains only whitespaces, or does not contain
* an initial substring that has the expected syntax for a
In many uses of av_expr_free() the pointer is NULLed afterwards, this should allow simplifying such code TODO: add bump& APIChanges Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavutil/eval.c | 7 +++++++ libavutil/eval.h | 6 ++++++ 2 files changed, 13 insertions(+)