summaryrefslogtreecommitdiff
path: root/src/references.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2016-05-24 15:50:44 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2016-06-06 15:39:05 -0700
commit42b07cc9c8d2e6251d190e5ea0d13fd66cb51e6d (patch)
tree493ffc6b16278c54da28645d96a9359717625576 /src/references.c
parent0eafc0af940646ab581e47e63090c1692a3525aa (diff)
cmake: Global handler for OOM situations
Diffstat (limited to 'src/references.c')
-rwxr-xr-xsrc/references.c20
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));
}