]> code.citadel.org Git - citadel.git/commitdiff
* alloc the right amount, and zero everything.
authorWilfried Göesgens <willi@citadel.org>
Thu, 1 Nov 2007 18:28:10 +0000 (18:28 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 1 Nov 2007 18:28:10 +0000 (18:28 +0000)
webcit/roomops.c

index 8c858aed35bb3f675ac371b2887c25ac1cf5331a..e5148d0914eaa0e78f9fad6e4a0cda492da67332 100644 (file)
@@ -3175,7 +3175,8 @@ void list_all_rooms_by_floor(char *viewpref) {
        for (i=0; i<num_floors; i++)
                if (IDMax < fold[i].floor)
                        IDMax = fold[i].floor;
-       floor_mapping = malloc (sizeof (int) * (num_floors + 1));
+       floor_mapping = malloc (sizeof (int) * (IDMax + 1));
+       memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
        for (i=0; i<num_floors; i++)
                floor_mapping[fold[i].floor]=i;