优化指针释放
This commit is contained in:
parent
1583ffcb42
commit
0e9a905f85
17
avs2bdnxml.c
17
avs2bdnxml.c
@ -291,6 +291,7 @@ int close_file_avis( avis_input_t *handle )
|
|||||||
AVIStreamRelease(h->p_avi);
|
AVIStreamRelease(h->p_avi);
|
||||||
AVIFileExit();
|
AVIFileExit();
|
||||||
free(h);
|
free(h);
|
||||||
|
h = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
fclose((FILE *)handle);
|
fclose((FILE *)handle);
|
||||||
@ -424,10 +425,18 @@ void write_png(char *dir, int file_id, uint8_t *image, int w, int h, int graphic
|
|||||||
/* Free memory */
|
/* Free memory */
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
free(row_pointers);
|
free(row_pointers);
|
||||||
|
row_pointers = NULL;
|
||||||
if (palette != NULL)
|
if (palette != NULL)
|
||||||
|
{
|
||||||
free(palette);
|
free(palette);
|
||||||
|
palette = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (trans != NULL)
|
if (trans != NULL)
|
||||||
|
{
|
||||||
free(trans);
|
free(trans);
|
||||||
|
trans = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Close file handle */
|
/* Close file handle */
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
@ -1187,11 +1196,17 @@ int main (int argc, char *argv[])
|
|||||||
assert(pal != NULL);
|
assert(pal != NULL);
|
||||||
write_sup_wrapper(sw, (uint8_t *)out_buf, n_crop, crops, pal, start_frame + to, i + to, split_at, min_split, stricter, mark_forced);
|
write_sup_wrapper(sw, (uint8_t *)out_buf, n_crop, crops, pal, start_frame + to, i + to, split_at, min_split, stricter, mark_forced);
|
||||||
if (!xml_output)
|
if (!xml_output)
|
||||||
|
{
|
||||||
free(pal);
|
free(pal);
|
||||||
pal = NULL;
|
pal = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (xml_output)
|
if (xml_output)
|
||||||
|
{
|
||||||
add_event_xml(events, split_at, min_split, start_frame + to, i + to, n_crop, crops, mark_forced);
|
add_event_xml(events, split_at, min_split, start_frame + to, i + to, n_crop, crops, mark_forced);
|
||||||
|
free(pal);
|
||||||
|
pal = NULL;
|
||||||
|
}
|
||||||
end_frame = i;
|
end_frame = i;
|
||||||
have_line = 0;
|
have_line = 0;
|
||||||
}
|
}
|
||||||
@ -1252,9 +1267,11 @@ int main (int argc, char *argv[])
|
|||||||
assert(pal != NULL);
|
assert(pal != NULL);
|
||||||
write_sup_wrapper(sw, (uint8_t *)out_buf, n_crop, crops, pal, start_frame + to, i - 1 + to, split_at, min_split, stricter, mark_forced);
|
write_sup_wrapper(sw, (uint8_t *)out_buf, n_crop, crops, pal, start_frame + to, i - 1 + to, split_at, min_split, stricter, mark_forced);
|
||||||
if (!xml_output)
|
if (!xml_output)
|
||||||
|
{
|
||||||
free(pal);
|
free(pal);
|
||||||
pal = NULL;
|
pal = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (xml_output)
|
if (xml_output)
|
||||||
{
|
{
|
||||||
add_event_xml(events, split_at, min_split, start_frame + to, i - 1 + to, n_crop, crops, mark_forced);
|
add_event_xml(events, split_at, min_split, start_frame + to, i - 1 + to, n_crop, crops, mark_forced);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user