summaryrefslogtreecommitdiff
path: root/legacy/eio
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@profusion.mobi>2012-06-20 19:34:05 +0000
committerLeandro Pereira <leandro@profusion.mobi>2012-06-20 19:34:05 +0000
commited4fd6b87772328b7f777363827bfdf7a88c07e6 (patch)
tree7c209c685ead9f740eafa13f251b473b5cd81ad7 /legacy/eio
parent74b38070b65c9d3e5dcb28f5e81d67a4d8a795ad (diff)
eio: Fix memory leaks spotted by clang static analyzer
SVN revision: 72552
Diffstat (limited to 'legacy/eio')
-rw-r--r--legacy/eio/src/lib/eio_dir.c1
-rw-r--r--legacy/eio/src/lib/eio_single.c51
2 files changed, 34 insertions, 18 deletions
diff --git a/legacy/eio/src/lib/eio_dir.c b/legacy/eio/src/lib/eio_dir.c
index 40d2b6a670..c71864dcfe 100644
--- a/legacy/eio/src/lib/eio_dir.c
+++ b/legacy/eio/src/lib/eio_dir.c
@@ -313,6 +313,7 @@ _eio_dir_chmod(Ecore_Thread *thread, Eio_Dir_Copy *order,
313 { 313 {
314 /* destroy in reverse order so that we don't prevent change of lower dir */ 314 /* destroy in reverse order so that we don't prevent change of lower dir */
315 dir = eina_list_data_get(eina_list_last(order->dirs)); 315 dir = eina_list_data_get(eina_list_last(order->dirs));
316 if (!dir) continue;
316 order->dirs = eina_list_remove_list(order->dirs, eina_list_last(order->dirs)); 317 order->dirs = eina_list_remove_list(order->dirs, eina_list_last(order->dirs));
317 318
318 /* build target dir path */ 319 /* build target dir path */
diff --git a/legacy/eio/src/lib/eio_single.c b/legacy/eio/src/lib/eio_single.c
index 4c2b240a35..fafeda5657 100644
--- a/legacy/eio/src/lib/eio_single.c
+++ b/legacy/eio/src/lib/eio_single.c
@@ -414,16 +414,18 @@ eio_file_direct_stat(const char *path,
414 s->path = eina_stringshare_add(path); 414 s->path = eina_stringshare_add(path);
415 s->done_cb = done_cb; 415 s->done_cb = done_cb;
416 416
417 if (!eio_file_set(&s->common, 417 if (eio_file_set(&s->common,
418 NULL, 418 NULL,
419 error_cb, 419 error_cb,
420 data, 420 data,
421 _eio_file_stat, 421 _eio_file_stat,
422 _eio_file_stat_done, 422 _eio_file_stat_done,
423 _eio_file_stat_error)) 423 _eio_file_stat_error))
424 return NULL; 424 return &s->common;
425 425
426 return &s->common; 426 eina_stringshare_del(path);
427 free(s);
428 return NULL;
427} 429}
428 430
429EAPI Eio_File * 431EAPI Eio_File *
@@ -444,16 +446,18 @@ eio_file_direct_lstat(const char *path,
444 s->path = eina_stringshare_add(path); 446 s->path = eina_stringshare_add(path);
445 s->done_cb = done_cb; 447 s->done_cb = done_cb;
446 448
447 if (!eio_file_set(&s->common, 449 if (eio_file_set(&s->common,
448 NULL, 450 NULL,
449 error_cb, 451 error_cb,
450 data, 452 data,
451 _eio_file_lstat, 453 _eio_file_lstat,
452 _eio_file_stat_done, 454 _eio_file_stat_done,
453 _eio_file_stat_error)) 455 _eio_file_stat_error))
454 return NULL; 456 return &s->common;
455 457
456 return &s->common; 458 eina_stringshare_del(path);
459 free(s);
460 return NULL;
457#else 461#else
458 return eio_file_direct_stat(path, done_cb, error_cb, data); 462 return eio_file_direct_stat(path, done_cb, error_cb, data);
459#endif 463#endif
@@ -475,16 +479,18 @@ eio_file_unlink(const char *path,
475 479
476 l->path = eina_stringshare_add(path); 480 l->path = eina_stringshare_add(path);
477 481
478 if (!eio_file_set(&l->common, 482 if (eio_file_set(&l->common,
479 done_cb, 483 done_cb,
480 error_cb, 484 error_cb,
481 data, 485 data,
482 _eio_file_unlink, 486 _eio_file_unlink,
483 _eio_file_unlink_done, 487 _eio_file_unlink_done,
484 _eio_file_unlink_error)) 488 _eio_file_unlink_error))
485 return NULL; 489 return &l->common;
486 490
487 return &l->common; 491 eina_stringshare_del(path);
492 free(l);
493 return NULL;
488} 494}
489 495
490EAPI Eio_File * 496EAPI Eio_File *
@@ -505,16 +511,18 @@ eio_file_mkdir(const char *path,
505 r->path = eina_stringshare_add(path); 511 r->path = eina_stringshare_add(path);
506 r->mode = mode; 512 r->mode = mode;
507 513
508 if (!eio_file_set(&r->common, 514 if (eio_file_set(&r->common,
509 done_cb, 515 done_cb,
510 error_cb, 516 error_cb,
511 data, 517 data,
512 _eio_file_mkdir, 518 _eio_file_mkdir,
513 _eio_file_mkdir_done, 519 _eio_file_mkdir_done,
514 _eio_file_mkdir_error)) 520 _eio_file_mkdir_error))
515 return NULL; 521 return &r->common;
516 522
517 return &r->common; 523 eina_stringshare_del(path);
524 free(r);
525 return NULL;
518} 526}
519 527
520EAPI Eio_File * 528EAPI Eio_File *
@@ -535,16 +543,18 @@ eio_file_chmod(const char *path,
535 r->path = eina_stringshare_add(path); 543 r->path = eina_stringshare_add(path);
536 r->mode = mode; 544 r->mode = mode;
537 545
538 if (!eio_file_set(&r->common, 546 if (eio_file_set(&r->common,
539 done_cb, 547 done_cb,
540 error_cb, 548 error_cb,
541 data, 549 data,
542 _eio_file_chmod, 550 _eio_file_chmod,
543 _eio_file_mkdir_done, 551 _eio_file_mkdir_done,
544 _eio_file_mkdir_error)) 552 _eio_file_mkdir_error))
545 return NULL; 553 return &r->common;
546 554
547 return &r->common; 555 eina_stringshare_del(path);
556 free(r);
557 return NULL;
548} 558}
549 559
550EAPI Eio_File * 560EAPI Eio_File *
@@ -567,14 +577,19 @@ eio_file_chown(const char *path,
567 c->user = eina_stringshare_add(user); 577 c->user = eina_stringshare_add(user);
568 c->group = eina_stringshare_add(group); 578 c->group = eina_stringshare_add(group);
569 579
570 if (!eio_file_set(&c->common, 580 if (eio_file_set(&c->common,
571 done_cb, 581 done_cb,
572 error_cb, 582 error_cb,
573 data, 583 data,
574 _eio_file_chown, 584 _eio_file_chown,
575 _eio_file_chown_done, 585 _eio_file_chown_done,
576 _eio_file_chown_error)) 586 _eio_file_chown_error))
577 return NULL; 587 return &c->common;
588
589 eina_stringshare_del(path);
590 eina_stringshare_del(user);
591 eina_stringshare_del(group);
592 free(c);
578 593
579 return &c->common; 594 return NULL;
580} 595}