Revision e1630aa8 TopologyManager/nccache.c

View differences:

TopologyManager/nccache.c
158 158
    if (c1[n1].timestamp == 0) {
159 159
      if (!in_cache(new_cache, &c2[n2])) {
160 160
        new_cache[i++] = c2[n2];
161
      } else {
162
        free(c2[n2].id);
161 163
      }
162 164
      n2++;
163 165
    } else if (c2[n2].timestamp == 0) {
164 166
      if (!in_cache(new_cache, &c1[n1])) {
165 167
        new_cache[i++] = c1[n1];
168
      } else {
169
        free(c1[n1].id);
166 170
      }
167 171
      n1++;
168 172
    } else {
169 173
      if (c2[n2].timestamp > c1[n1].timestamp) {
170 174
        if (!in_cache(new_cache, &c1[n1])) {
171 175
          new_cache[i++] = c1[n1];
176
        } else {
177
          free(c1[n1].id);
172 178
        }
173 179
        n1++;
174 180
      } else {
175 181
        if (!in_cache(new_cache, &c2[n2])) {
176 182
          new_cache[i++] = c2[n2];
183
        } else {
184
          free(c2[n2].id);
177 185
        }
178 186
        n2++;
179 187
      }
180 188
    }
181 189
  }
182 190

  
191
  while (c1[n1].timestamp != 0) {
192
    free(c1[n1++].id);
193
  }
194
  while (c2[n2].timestamp != 0) {
195
    free(c2[n2++].id);
196
  }
197

  
183 198
  return new_cache;
184 199
}

Also available in: Unified diff