Skip to content

Commit 43454fc

Browse files
author
greatriver
committed
Fix memory leaks of the pdf_drop_font
1 parent a58cd83 commit 43454fc

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

source/pdf/pdf-font.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pdf_new_font_desc(hd_context *ctx)
3535
pdf_font_desc *fontdesc;
3636

3737
fontdesc = hd_malloc_struct(ctx, pdf_font_desc);
38+
HD_INIT_STORABLE(fontdesc, 1, pdf_drop_font_imp);
3839
fontdesc->size = sizeof(pdf_font_desc);
3940

4041
fontdesc->flags = 0;
@@ -144,7 +145,6 @@ pdf_load_simple_font_by_name(hd_context *ctx, pdf_obj *dict)
144145
{
145146
pdf_obj *descriptor;
146147
pdf_obj *encoding;
147-
unsigned short *etable = NULL;
148148
pdf_font_desc *fontdesc = NULL;
149149

150150
int symbolic;
@@ -162,12 +162,10 @@ pdf_load_simple_font_by_name(hd_context *ctx, pdf_obj *dict)
162162
descriptor = pdf_dict_get(ctx, dict, PDF_NAME_FontDescriptor);
163163
fontdesc->flags = pdf_to_int(ctx, pdf_dict_get(ctx, descriptor, PDF_NAME_Flags));
164164

165-
etable = hd_malloc_array(ctx, 256, sizeof(unsigned short));
166165
fontdesc->size += 256 * sizeof(unsigned short);
167166
for (i = 0; i < 256; i++)
168167
{
169168
estrings[i] = NULL;
170-
etable[i] = 0;
171169
}
172170

173171
symbolic = fontdesc->flags & 4;

0 commit comments

Comments
 (0)