summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2013-10-17 16:52:02 +0200
committerStefano Sabatini <stefasab@gmail.com>2013-10-17 18:02:54 +0200
commit98e7c1eed5593ee65741b62969bb105fc1608d0f (patch)
tree74ff2f91394d7a8ba668e63a658e81b33d1da6ea /libavutil/opt.c
parentd0a3bc13025baab8d48cbcf4c698daf2f0c44adc (diff)
lavu/opt-test: use automatic set and free handlers
In particular, do not set default string value by hand and use av_opt_free() to free context.
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index c035307053..d282af2f29 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1559,7 +1559,7 @@ int main(void)
av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
printf("\n");
}
- av_freep(&test_ctx.string);
+ av_opt_free(&test_ctx);
}
printf("\nTesting av_opt_set_from_string()\n");
@@ -1580,7 +1580,6 @@ int main(void)
test_ctx.class = &test_class;
av_opt_set_defaults(&test_ctx);
- test_ctx.string = av_strdup("default");
av_log_set_level(AV_LOG_DEBUG);
@@ -1590,7 +1589,7 @@ int main(void)
av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
printf("\n");
}
- av_freep(&test_ctx.string);
+ av_opt_free(&test_ctx);
}
return 0;