Changeset 4648 for trunk/Nebulous/nebclient
- Timestamp:
- Jul 28, 2005, 1:03:45 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous/nebclient/src/nebclient.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/nebclient/src/nebclient.c
r4646 r4648 4 4 * Copyright (C) 2005 Joshua Hoblitt 5 5 * 6 * $Id: nebclient.c,v 1.3 0 2005-07-28 21:55:52jhoblitt Exp $6 * $Id: nebclient.c,v 1.31 2005-07-28 23:03:45 jhoblitt Exp $ 7 7 */ 8 8 … … 183 183 { 184 184 char **locations; 185 186 if (nebFindInstances(server, key, NULL, &locations) < 2) { 185 int instances; 186 187 instances = nebFindInstances(server, key, NULL, &locations); 188 if (instances < 2) { 187 189 nebSetErr(server, "can not cull - not enough instances"); 190 if (instances) { 191 nebFree(locations); 192 } 188 193 189 194 return false; … … 262 267 char **loc; 263 268 264 // FIXME is this leaking memory when response goes out of scope? 269 // FIXME is this leaking memory when response goes out of scope? the gsoap 270 // manual seems to 'suggest' that this is temporary data that gets cleaed 271 // up on the next soap function call 265 272 if (soap_call_ns1__find_USCOREinstances(server->soap, server->endpoint, 266 273 NULL, (char *)key, (char *)volume, &response) != SOAP_OK) { … … 270 277 271 278 resultElements = response.result->__size; 272 resultArray = response.result->__ptr; 273 274 loc = xmalloc(sizeof(char*) * resultElements); 275 276 for (i = 0; i < resultElements; i++) { 277 loc[i] = xmalloc(strlen(resultArray[i]) + 1); 278 279 strcpy(loc[i], resultArray[i]); 280 } 281 282 *locations = loc; 279 280 if (locations) { 281 if (resultElements) { 282 resultArray = response.result->__ptr; 283 284 loc = xmalloc(sizeof(char*) * resultElements); 285 286 for (i = 0; i < resultElements; i++) { 287 loc[i] = xmalloc(strlen(resultArray[i]) + 1); 288 289 strcpy(loc[i], resultArray[i]); 290 } 291 292 *locations = loc; 293 } else { 294 *locations = NULL; 295 } 296 } 283 297 284 298 return resultElements; … … 290 304 char *filename; 291 305 292 if (nebFindInstances(server, key, NULL, &locations) < 0) {306 if (nebFindInstances(server, key, NULL, &locations) < 1) { 293 307 nebSetErr(server, "no instances found"); 294 308 … … 324 338 if (!nebParseURI(server, locations[0], &filename)) { 325 339 nebSetErr(server, "can not parse URI"); 340 nebFree(locations); 326 341 327 342 return -1; … … 332 347 nebSetErr(server, "write not allowed with multiple instances"); 333 348 nebFree(filename); 349 nebFree(locations); 334 350 335 351 return -1; … … 344 360 if (fh < 0) { 345 361 nebSetErr(server, "open: %s", strerror(errno)); 346 347 return -1; 348 } 362 nebFree(locations); 363 364 return -1; 365 } 366 367 nebFree(locations); 349 368 350 369 return fh; … … 361 380 if (n < 0) { 362 381 nebSetErr(server, "no instances found"); 382 nebFree(locations); 363 383 364 384 return false; … … 467 487 stat = xmalloc(sizeof(nebObjectStat)); 468 488 469 // FIXME is this leaking memory when response goes out of scope? 489 // FIXME is this leaking memory when response goes out of scope? the gsoap 490 // manual seems to 'suggest' that this is temporary data that gets cleaed 491 // up on the next soap function call 470 492 if (soap_call_ns1__stat_USCOREobject(server->soap, server->endpoint, 471 493 NULL, (char *)key, &response) != SOAP_OK) {
Note:
See TracChangeset
for help on using the changeset viewer.
