Browse code

static buffer realloc correction

Michal Matyska authored on 10/08/2006 10:49:11
Showing 1 changed files
... ...
@@ -67,6 +67,7 @@ static int active_buffer=-1;
67 67
 #define ALLOC_SIZE(req_size) (((req_size/BUFFER_GRANULARITY)+1)*BUFFER_GRANULARITY)
68 68
 
69 69
 int allocate_buffer(int req_size) {
70
+	void *b;
70 71
 	int size=ALLOC_SIZE(req_size);
71 72
 	
72 73
 	if (buffer[active_buffer].b == NULL) {
... ...
@@ -83,7 +84,8 @@ int allocate_buffer(int req_size) {
83 83
 		return 1;
84 84
 	}
85 85
 	
86
-	if (pkg_realloc(buffer[active_buffer].b,size)) {
86
+	if ((b=pkg_realloc(buffer[active_buffer].b,size))) {
87
+		buffer[active_buffer].b=b;
87 88
 		buffer[active_buffer].size=size;
88 89
 		buffer[active_buffer].offset=0;
89 90
 		return 1;