From ab26d9b7e8ca7e861a2f40dd00f81029b67fef91 Mon Sep 17 00:00:00 2001 From: Fabio Colacio Date: Thu, 3 May 2018 10:59:47 -0700 Subject: [PATCH] Copy base_folder parameter in hoedown_document_new() --- src/document.c | 4 ++-- src/document.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/document.c b/src/document.c index e478ba16..49bf9d71 100644 --- a/src/document.c +++ b/src/document.c @@ -3295,7 +3295,7 @@ hoedown_document_new( const hoedown_renderer *renderer, hoedown_extensions extensions, ext_definition * user_ext, - char * base_folder, + const char * base_folder, size_t max_nesting) { hoedown_document *doc = NULL; @@ -3306,7 +3306,7 @@ hoedown_document_new( memcpy(&doc->md, renderer, sizeof(hoedown_renderer)); doc->extensions = user_ext; - doc->base_folder = base_folder; + doc->base_folder = (base_folder != NULL) ? strdup (base_folder) : NULL; doc->counter = (h_counter){0, 0, 0}; diff --git a/src/document.h b/src/document.h index a07910b5..ad3d7514 100644 --- a/src/document.h +++ b/src/document.h @@ -244,7 +244,7 @@ hoedown_document *hoedown_document_new( const hoedown_renderer *renderer, hoedown_extensions extensions, ext_definition * exeternal_extensions, - char * base_folder, + const char * base_folder, size_t max_nesting ) __attribute__ ((malloc));