Learn more about these different git repos.
Other Git URLs
319errno_t get_sssd_pid(pid_t *out_pid) 320{ 321 int ret; 322 FILE *pid_file = NULL; 323 char pid_str[MAX_PID_LENGTH] = {'\0'}; 324 325 *out_pid = 0; 326 327 errno = 0; CID 11032: Resource leak (RESOURCE_LEAK)Calling allocation function "fopen". Assigning: "pid_file" = storage returned from "fopen("/var/run/sssd.pid", "r")". 328 pid_file = fopen(SSSD_PIDFILE, "r"); At conditional (1): "pid_file == NULL" taking the false branch. 329 if (pid_file == NULL) { 330 ret = errno; 331 DEBUG(SSSDBG_MINOR_FAILURE, ("Unable to open pid file \"%s\": %s\n", 332 SSSD_PIDFILE, strerror(ret))); 333 goto done; 334 } 335 Variable "pid_file" is not freed or pointed-to in function "fread". 336 ret = fread(pid_str, sizeof(char), MAX_PID_LENGTH * sizeof(char), pid_file); At conditional (2): "!feof(pid_file)" taking the false branch. Variable "pid_file" is not freed or pointed-to in function "feof". 337 if (!feof(pid_file)) { 338 /* eof not reached */ 339 ret = ferror(pid_file); 340 if (ret != 0) { 341 DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to read from file \"%s\": %s\n", 342 SSSD_PIDFILE, strerror(ret))); 343 } else { 344 DEBUG(SSSDBG_CRIT_FAILURE, ("File \"%s\" contains invalid pid.\n", 345 SSSD_PIDFILE)); 346 } 347 goto done; 348 } 349 350 *out_pid = parse_pid(pid_str); At conditional (3): "*out_pid == 0" taking the true branch. 351 if (*out_pid == 0) { At conditional (4): "debug_level & __debug_macro_newlevel" taking the true branch. At conditional (5): "debug_timestamps" taking the true branch. At conditional (6): "debug_microseconds" taking the true branch. 352 DEBUG(SSSDBG_CRIT_FAILURE, 353 ("File \"%s\" contains invalid pid.\n", SSSD_PIDFILE)); Variable "pid_file" going out of scope leaks the storage it points to. 354 return EINVAL; 355 } 356 357 ret = EOK; 358 359done: 360 if (pid_file != NULL) { 361 fclose(pid_file); 362 } 363 return ret; 364} 365
Fields changed
patch: 0 => 1 status: new => assigned
keywords: => Coverity
Fixed by 41a327a
resolution: => fixed status: assigned => closed
rhbz: => 0
Metadata Update from @sgallagh: - Issue assigned to sgallagh - Issue set to the milestone: SSSD 1.7.0
SSSD is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in SSSD's github repository.
This issue has been cloned to Github and is available here: - https://github.com/SSSD/sssd/issues/2084
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Login to comment on this ticket.