comparison rcg.c @ 6:910e059abd6d

rcg.c: fix bug with realloc()
author paulo@twcdns.fastsearch.net
date Tue, 06 Apr 2010 22:51:22 -0700
parents 26e28ec5fe87
children 0b9cf47655fe
comparison
equal deleted inserted replaced
4:d486aba4efcf 5:ab7fda588dae
86 while (fgets(buf, BUFSIZE, stdin)) 86 while (fgets(buf, BUFSIZE, stdin))
87 { 87 {
88 int so = -1; 88 int so = -1;
89 int eo = -1; 89 int eo = -1;
90 90
91 size_t out_len = strlen(buf); 91 size_t out_len = strlen(buf) + 1;
92 char *out = calloc(out_len, sizeof(char)); 92 char *out = calloc(out_len, sizeof(char));
93 unsigned int out_pos = 0; 93 unsigned int out_pos = 0;
94 unsigned int buf_pos = 0; 94 unsigned int buf_pos = 0;
95 95
96 for (re_err = 0; re_err != REG_NOMATCH;) 96 for (re_err = 0; re_err != REG_NOMATCH;)