diff options
author | Tor Andersson <tor@ghostscript.com> | 2011-01-27 22:35:26 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2011-01-27 22:35:26 +0000 |
commit | 3802ebf92723382070258bcd43771b2f4186c03f (patch) | |
tree | cb0ca60a270dd9b73918015ee8e8cd86b1dc0296 /fitz/res_path.c | |
parent | 836d6cb3d16e94929be98c000a35255a5ffe37ff (diff) | |
download | mupdf-3802ebf92723382070258bcd43771b2f4186c03f.tar.xz |
Add fz_calloc function to check for integer overflow when allocating arrays, and change the signature of fz_realloc to match.
Diffstat (limited to 'fitz/res_path.c')
-rw-r--r-- | fitz/res_path.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fitz/res_path.c b/fitz/res_path.c index 0fc1882e..6c5f1802 100644 --- a/fitz/res_path.c +++ b/fitz/res_path.c @@ -23,7 +23,7 @@ fz_clonepath(fz_path *old) path->len = old->len; path->cap = path->len; - path->els = fz_malloc(path->cap * sizeof(fz_pathel)); + path->els = fz_calloc(path->cap, sizeof(fz_pathel)); memcpy(path->els, old->els, sizeof(fz_pathel) * path->len); return path; @@ -43,7 +43,7 @@ growpath(fz_path *path, int n) return; while (path->len + n > path->cap) path->cap = path->cap + 36; - path->els = fz_realloc(path->els, sizeof (fz_pathel) * path->cap); + path->els = fz_realloc(path->els, path->cap, sizeof(fz_pathel)); } void |