| author | Marek Kasik <mkasik@redhat.com> | 2010-11-24 14:54:14 (GMT) |
|---|---|---|
| committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2010-12-04 15:14:58 (GMT) |
| commit | 8ffd9185f81cb8337cece4c8e3672d0e6a97e935 (patch) (side-by-side diff) | |
| tree | 6d7344a40a3e69579846b96cff097867c45d74a6 | |
| parent | 7500e4d1ae85ecf9f61b1446e07ebb887118757c (diff) | |
| download | libspectre-master.zip libspectre-master.tar.gz | |
Allocate at least 1 page if there are no %%Pages: or %%Page: comments
in the PS file (#31512).
| -rw-r--r-- | libspectre/ps.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libspectre/ps.c b/libspectre/ps.c index 4578cec..0130fb4 100644 --- a/libspectre/ps.c +++ b/libspectre/ps.c @@ -1004,14 +1004,14 @@ psscan(const char *filename, int scanstyle) section_len += line_len; } + if (maxpages == 0) { + maxpages = 1; + doc->pages = (struct page *) PS_calloc(maxpages, sizeof(struct page)); + CHECK_MALLOCED(doc->pages); + } newpage: while (DSCcomment(line) && iscomment(line+2, "Page:")) { - if (maxpages == 0) { - maxpages = 1; - doc->pages = (struct page *) PS_calloc(maxpages, sizeof(struct page)); - CHECK_MALLOCED(doc->pages); - } label = ps_gettext(line+length("%%Page:"), &next_char); if (sscanf(next_char, "%u", &thispage) != 1) thispage = 0; if (nextpage == 1) { |
