File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -187,15 +187,13 @@ static int parse_fmt(struct state_video_compress_cineform *s, char *fmt) {
187187static void * cineform_compress_init (struct module *parent, const char *opts)
188188{
189189 (void ) parent;
190- struct state_video_compress_cineform *s;
191190
192- s = new state_video_compress_cineform ();
191+ auto s = std::make_unique< state_video_compress_cineform> ();
193192
194193 char *fmt = strdup (opts);
195- int ret = parse_fmt (s, fmt);
194+ int ret = parse_fmt (s. get () , fmt);
196195 free (fmt);
197196 if (ret != 0 ) {
198- delete s;
199197 return ret > 0 ? INIT_NOERR : nullptr ;
200198 }
201199
@@ -207,14 +205,12 @@ static void * cineform_compress_init(struct module *parent, const char *opts)
207205 nullptr );
208206 if (status != CFHD_ERROR_OKAY){
209207 log_msg (LOG_LEVEL_ERROR, " [cineform] Failed to create encoder pool\n " );
210- delete s;
211208 return nullptr ;
212209 }
213210 status = CFHD_MetadataOpen (&s->metadataRef );
214211 if (status != CFHD_ERROR_OKAY){
215212 log_msg (LOG_LEVEL_ERROR, " [cineform] Failed to create metadataRef\n " );
216213 CFHD_ReleaseEncoderPool (s->encoderPoolRef );
217- delete s;
218214 return nullptr ;
219215 }
220216
@@ -223,7 +219,7 @@ static void * cineform_compress_init(struct module *parent, const char *opts)
223219 s->started = false ;
224220 s->stop = false ;
225221
226- return s;
222+ return s. release () ;
227223}
228224
229225static struct {
You can’t perform that action at this time.
0 commit comments