src/server/object.c

changeset 12
34aa8001ea53
parent 6
ce8fecc9847d
child 13
1fdbf4170ef4
--- a/src/server/object.c	Fri Dec 30 15:19:16 2011 +0100
+++ b/src/server/object.c	Fri Dec 30 17:50:05 2011 +0100
@@ -58,7 +58,17 @@
 void object_add_directive(httpd_object *obj, directive *dir, int dt) {
     dtable *l = object_get_dtable(obj, dt);
     // allocate space for the new directive
-    l->dirs = realloc(l->dirs, (l->ndir+1)*sizeof(directive*));
+
+    l->dirs = realloc(l->dirs, (l->ndir+1)*sizeof(void*));
+    /* TODO: aus irgend einem Grund funktioniert realloc nicht. warum?? */
+    
+    directive **drs = malloc((l->ndir+1)*sizeof(void*));
+    for(int i=0;i<l->ndir;i++) {
+        drs[i] = l->dirs[i];
+    }
+    free(l->dirs);
+    l->dirs = drs;
+
     // add directive
     l->dirs[l->ndir] = dir;
     l->ndir++;

mercurial