浏览代码

Fixed nasty bug on fixed lists: Empty fixed lists should not return pointers.

Ioannis Koutras 13 年之前
父节点
当前提交
b78d869836
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/linked_lists/search_algorithms.c

+ 2 - 2
src/linked_lists/search_algorithms.c

@@ -38,8 +38,8 @@ void * search_on_fixed(heap_t * heap, size_t requested_size) {
         heap->dmm_stats.total_hops++;
 #endif /* COUNT_HOPS */
         if(node->size == requested_size) {
-            ptr = node->fixed_list_head;
-            if(ptr != NULL) {
+            if(node->fixed_list_head != NULL) {
+                ptr = node->fixed_list_head;
                 node->fixed_list_head = get_next(ptr);
 #ifdef BLOCKS_IN_DLL
                 set_previous(node->fixed_list_head, NULL);