Index: trunk/debs/squid/redirector.c |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | #include <stdio.h> |
13 | 13 | #include <stdlib.h> |
14 | 14 | #include <string.h> |
| 15 | +#include <malloc.h> |
15 | 16 | #include <pcre.h> |
16 | 17 | |
17 | 18 | #define MAX_BUFF 8256 |
— | — | @@ -62,11 +63,10 @@ |
63 | 64 | |
64 | 65 | struct IN_BUFF *in_buff = NULL; |
65 | 66 | in_buff = (struct IN_BUFF *)malloc(sizeof(struct IN_BUFF)); |
66 | | - in_buff->url = (char *)malloc(MAX_BUFF); |
67 | | - in_buff->src_address = (char *)malloc(MAX_BUFF); |
68 | | - in_buff->ident = (char *)malloc(MAX_BUFF); |
69 | | - in_buff->method = (char *)malloc(MAX_BUFF); |
70 | | - int buff_status = 0; |
| 67 | + in_buff->url = malloc(MAX_BUFF); |
| 68 | + in_buff->src_address = malloc(MAX_BUFF); |
| 69 | + in_buff->ident = malloc(MAX_BUFF); |
| 70 | + in_buff->method = malloc(MAX_BUFF); |
71 | 71 | pattern = "^http:\\/\\/(\\w+)\\.wikipedia\\.org[:\\d]*\\/(.*)"; |
72 | 72 | pcre_extra *pe; |
73 | 73 | |
— | — | @@ -92,7 +92,10 @@ |
93 | 93 | |
94 | 94 | while(fgets(buff, MAX_BUFF, stdin) != NULL) { |
95 | 95 | |
96 | | - buff_status = load_in_buff(buff, in_buff); |
| 96 | + if (load_in_buff(buff, in_buff) != 0) { |
| 97 | + fprintf(stderr, "Error loading data %s\n", buff); |
| 98 | + continue; |
| 99 | + } |
97 | 100 | |
98 | 101 | subject_length = (int)strlen(in_buff->url); |
99 | 102 | |