Introduction
Introduction Statistics Contact Development Disclaimer Help
tuc: store a pointer to the terminating zero in uc_chop() - neatvi - [fork] sim…
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 6831be74582cbec67c8fcba98df286fbf8839015
parent 4b7eb1d70cfc9a1ac8d1bd602d461b60f40ba3f5
Author: Ali Gholami Rudi <[email protected]>
Date: Sat, 9 May 2015 00:09:54 +0430
uc: store a pointer to the terminating zero in uc_chop()
Diffstat:
M uc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/uc.c b/uc.c
t@@ -86,8 +86,8 @@ char **uc_chop(char *s, int *n)
char **chrs;
int i;
*n = uc_slen(s);
- chrs = malloc(*n * sizeof(chrs[0]));
- for (i = 0; i < *n; i++) {
+ chrs = malloc((*n + 1) * sizeof(chrs[0]));
+ for (i = 0; i < *n + 1; i++) {
chrs[i] = s;
s = uc_next(s);
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.