mirror of
				https://github.com/simon987/libscan.git
				synced 2025-10-28 00:06:54 +00:00 
			
		
		
		
	memory fixes
This commit is contained in:
		
							parent
							
								
									8798078798
								
							
						
					
					
						commit
						67a5da9ac0
					
				| @ -140,8 +140,8 @@ scan_code_t parse_archive(scan_arc_ctx_t *ctx, vfile_t *f, document_t *doc) { | |||||||
|         memcpy(sub_job->parent, doc->uuid, sizeof(uuid_t)); |         memcpy(sub_job->parent, doc->uuid, sizeof(uuid_t)); | ||||||
| 
 | 
 | ||||||
|         while (archive_read_next_header(a, &entry) == ARCHIVE_OK) { |         while (archive_read_next_header(a, &entry) == ARCHIVE_OK) { | ||||||
|             sub_job->info = *archive_entry_stat(entry); |             sub_job->vfile.info = *archive_entry_stat(entry); | ||||||
|             if (S_ISREG(sub_job->info.st_mode)) { |             if (S_ISREG(sub_job->vfile.info.st_mode)) { | ||||||
|                 sprintf(sub_job->filepath, "%s#/%s", f->filepath, archive_entry_pathname(entry)); |                 sprintf(sub_job->filepath, "%s#/%s", f->filepath, archive_entry_pathname(entry)); | ||||||
|                 sub_job->base = (int) (strrchr(sub_job->filepath, '/') - sub_job->filepath) + 1; |                 sub_job->base = (int) (strrchr(sub_job->filepath, '/') - sub_job->filepath) + 1; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -46,4 +46,5 @@ void parse_cbr(scan_cbr_ctx_t *ctx, vfile_t *f, document_t *doc) { | |||||||
|     parse_ebook_mem(&ctx->ebook_ctx, out_buf, out_buf_used, "application/x-cbz", doc); |     parse_ebook_mem(&ctx->ebook_ctx, out_buf, out_buf_used, "application/x-cbz", doc); | ||||||
|     doc->mime = ctx->cbr_mime; |     doc->mime = ctx->cbr_mime; | ||||||
|     free(out_buf); |     free(out_buf); | ||||||
|  |     free(buf); | ||||||
| } | } | ||||||
|  | |||||||
| @ -150,6 +150,7 @@ void parse_font(scan_font_ctx_t *ctx, vfile_t *f, document_t *doc) { | |||||||
|     FT_Error err = FT_New_Memory_Face(ft_lib, (unsigned char *) buf, buf_len, 0, &face); |     FT_Error err = FT_New_Memory_Face(ft_lib, (unsigned char *) buf, buf_len, 0, &face); | ||||||
|     if (err != 0) { |     if (err != 0) { | ||||||
|         CTX_LOG_ERRORF(doc->filepath, "(font.c) FT_New_Memory_Face() returned error code [%d] %s", err, FT_Error_String(err)) |         CTX_LOG_ERRORF(doc->filepath, "(font.c) FT_New_Memory_Face() returned error code [%d] %s", err, FT_Error_String(err)) | ||||||
|  |         free(buf); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -172,6 +173,7 @@ void parse_font(scan_font_ctx_t *ctx, vfile_t *f, document_t *doc) { | |||||||
| 
 | 
 | ||||||
|     if (ctx->enable_tn == TRUE) { |     if (ctx->enable_tn == TRUE) { | ||||||
|         FT_Done_Face(face); |         FT_Done_Face(face); | ||||||
|  |         free(buf); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -182,6 +184,7 @@ void parse_font(scan_font_ctx_t *ctx, vfile_t *f, document_t *doc) { | |||||||
|     if (err != 0) { |     if (err != 0) { | ||||||
|         CTX_LOG_WARNINGF(doc->filepath, "(font.c) FT_Set_Pixel_Sizes() returned error code [%d] %s", err, FT_Error_String(err)) |         CTX_LOG_WARNINGF(doc->filepath, "(font.c) FT_Set_Pixel_Sizes() returned error code [%d] %s", err, FT_Error_String(err)) | ||||||
|         FT_Done_Face(face); |         FT_Done_Face(face); | ||||||
|  |         free(buf); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -228,6 +231,7 @@ void parse_font(scan_font_ctx_t *ctx, vfile_t *f, document_t *doc) { | |||||||
|     free(bitmap); |     free(bitmap); | ||||||
| 
 | 
 | ||||||
|     FT_Done_Face(face); |     FT_Done_Face(face); | ||||||
|  |     free(buf); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void cleanup_font() { | void cleanup_font() { | ||||||
|  | |||||||
| @ -126,7 +126,6 @@ typedef struct vfile { | |||||||
| typedef struct parse_job_t { | typedef struct parse_job_t { | ||||||
|     int base; |     int base; | ||||||
|     int ext; |     int ext; | ||||||
|     struct stat info; |  | ||||||
|     struct vfile vfile; |     struct vfile vfile; | ||||||
|     uuid_t parent; |     uuid_t parent; | ||||||
|     char filepath[1]; |     char filepath[1]; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user