aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-02-26 19:47:33 +0100
committerThomas White <taw@bitwiz.org.uk>2016-02-26 19:47:33 +0100
commit9c72012798f35ca256d34fc044ba21abfe65af0a (patch)
treeb641e409b2a863f5a4584e76134707d32ea6fb23 /src
parentdf8db57c753129e703e588323fa97db2a4ac9058 (diff)
Memory fixes
Diffstat (limited to 'src')
-rw-r--r--src/boxvec.c2
-rw-r--r--src/wrap.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/boxvec.c b/src/boxvec.c
index 06754e6..7cdd01c 100644
--- a/src/boxvec.c
+++ b/src/boxvec.c
@@ -47,7 +47,7 @@ extern struct boxvec *bv_new()
n->max_boxes = 0;
n->boxes = NULL;
- return NULL;
+ return n;
}
diff --git a/src/wrap.c b/src/wrap.c
index 9fc233f..3668d4b 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -925,7 +925,7 @@ int wrap_contents(struct frame *fr)
/* Split text into paragraphs */
i = 0;
fr->n_paragraphs = 0;
- fr->paragraphs = malloc(max_para * sizeof(struct wrap_line *));
+ fr->paragraphs = malloc(max_para * sizeof(struct boxvec *));
if ( fr->paragraphs == NULL ) {
fprintf(stderr, "Failed to allocate paragraphs\n");
return 1;
@@ -938,7 +938,7 @@ int wrap_contents(struct frame *fr)
if ( fr->n_paragraphs == max_para ) {
max_para += 64;
fr->paragraphs = realloc(fr->paragraphs,
- max_para*sizeof(struct wrap_line *));
+ max_para*sizeof(struct boxvec *));
if ( fr->paragraphs == NULL ) {
fprintf(stderr, "Failed to allocate space"
" for paragraphs\n");