diff options
Diffstat (limited to 'src/references.c')
-rwxr-xr-x | src/references.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/references.c b/src/references.c index 6cb2b20..168bd89 100755 --- a/src/references.c +++ b/src/references.c @@ -76,16 +76,14 @@ void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label, if (reflabel == NULL) return; - ref = (cmark_reference *)calloc(1, sizeof(*ref)); - if (ref != NULL) { - ref->label = reflabel; - ref->hash = refhash(ref->label); - ref->url = cmark_clean_url(url); - ref->title = cmark_clean_title(title); - ref->next = NULL; - - add_reference(map, ref); - } + ref = (cmark_reference *)cmark_calloc(1, sizeof(*ref)); + ref->label = reflabel; + ref->hash = refhash(ref->label); + ref->url = cmark_clean_url(url); + ref->title = cmark_clean_title(title); + ref->next = NULL; + + add_reference(map, ref); } // Returns reference if refmap contains a reference with matching @@ -140,5 +138,5 @@ void cmark_reference_map_free(cmark_reference_map *map) { } cmark_reference_map *cmark_reference_map_new(void) { - return (cmark_reference_map *)calloc(1, sizeof(cmark_reference_map)); + return (cmark_reference_map *)cmark_calloc(1, sizeof(cmark_reference_map)); } |