Resource acquired to 'fp' at line 3540 may be lost here.
Resource acquired to 'debug_log' at line 1690 may be lost here.
Resource acquired to 'mattr' at line 471 may be lost here.
Resource acquired to 'conn->oc_fd' at line 208 may be lost here.
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: I47a1c44d8b1cfd8500ca71958814b8a23d6fff2b
Reviewed-on: http://review.whamcloud.com/9343
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
strerror(errno));
hur = oldhur;
rc = -errno;
+ fclose(fp);
goto out_free;
}
memcpy(hur, oldhur, hur_len(oldhur));
rc = lfs_hsm_prepare_file(line, &hui->hui_fid,
&last_dev);
hur->hur_request.hr_itemcount++;
- if (rc)
+ if (rc) {
+ fclose(fp);
goto out_free;
+ }
if ((some_file[0] == '\0') &&
(strlen(line) < sizeof(some_file)))
break;
case 'D':
/* Undocumented option debug log file */
+ if (debug_log != NULL)
+ fclose(debug_log);
debug_log = fopen(optarg, "a");
if (debug_log == NULL) {
printf("Cannot open %s for debug log\n",
rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
if (rc != 0) {
fprintf(stderr, "Can't set shared mutex attr\n");
- return rc;
+ goto out;
}
rc = pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED);
if (rc != 0) {
fprintf(stderr, "Can't set shared cond attr\n");
- return rc;
+ goto out;
}
pthread_mutex_init(&shared_data->mutex, &mattr);
pthread_cond_init(&shared_data->cond, &cattr);
-
+out:
pthread_mutexattr_destroy(&mattr);
pthread_condattr_destroy(&cattr);
- return 0;
+ return rc;
}
static inline void shmem_lock(void)
return (1);
b = obdio_new_barrier (oid, bid, npeers);
- if (b == NULL)
- return (1);
+ if (b == NULL) {
+ rc = 1;
+ goto out;
+ }
rc = 0;
if (setup) {
}
free(b);
-
+out:
obdio_disconnect(conn, 0);
return (rc == 0 ? 0 : 1);