diff options
author | Nick White <git@njw.me.uk> | 2011-08-18 23:37:25 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2011-08-18 23:37:25 +0100 |
commit | 496e3d7171044a381b91a9a077e7ecc53cd19f97 (patch) | |
tree | 8f3b4c56665fb7eb31191ec567ebb245d2dee819 | |
parent | fd9b2a8213fcd98cba454ef8c3b71ad3b806cc12 (diff) |
Fix memory allocation bugs
-rw-r--r-- | getgbook.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -140,8 +140,8 @@ int main(int argc, char *argv[]) */ Page **page; - page = malloc(sizeof(Page) * 1000); - for(i=0; i<1000; i++) page[i] = malloc(sizeof(*page)); + page = malloc(sizeof(*page) * 1000); + for(i=0; i<1000; i++) page[i] = malloc(sizeof(**page)); if(!(i = getpagelist(bookid, page))) { fprintf(stderr, "Could not find pages for %s\n", bookid); return 1; |