Unified · Split
| @@ -288,35 +288,25 @@ Conf_save_start_error conf_save_start(Conf_save *p, · 287 unmodified lines | ||
| 288 | 288 | err = Conf_save_start_no_home; |
| 289 | 289 | goto cleanup; |
| 290 | 290 | } |
| 291 | − if (!dir) { | |
| 292 | − err = Conf_save_start_alloc_failed; | |
| 293 | − goto cleanup; | |
| 294 | − } | |
| 291 | + if (!dir) | |
| 292 | + goto allocfail; | |
| 295 | 293 | osoputoso(&p->canonpath, dir); |
| 296 | − if (!p->canonpath) { | |
| 297 | − err = Conf_save_start_alloc_failed; | |
| 298 | − goto cleanup; | |
| 299 | − } | |
| 294 | + if (!p->canonpath) | |
| 295 | + goto allocfail; | |
| 300 | 296 | size_t namelen = strlen(conf_file_name); |
| 301 | 297 | if (namelen == 0) { |
| 302 | 298 | err = Conf_save_start_bad_conf_name; |
| 303 | 299 | goto cleanup; |
| 304 | 300 | } |
| 305 | 301 | conf_impl_catconfpath(&p->canonpath, conf_file_name, namelen); |
| 306 | − if (!p->canonpath) { | |
| 307 | − err = Conf_save_start_alloc_failed; | |
| 308 | − goto cleanup; | |
| 309 | − } | |
| 302 | + if (!p->canonpath) | |
| 303 | + goto allocfail; | |
| 310 | 304 | osoputoso(&p->temppath, p->canonpath); |
| 311 | − if (!p->temppath) { | |
| 312 | − err = Conf_save_start_alloc_failed; | |
| 313 | − goto cleanup; | |
| 314 | − } | |
| 305 | + if (!p->temppath) | |
| 306 | + goto allocfail; | |
| 315 | 307 | osocat(&p->temppath, ".tmp"); |
| 316 | − if (!p->temppath) { | |
| 317 | − err = Conf_save_start_alloc_failed; | |
| 318 | − goto cleanup; | |
| 319 | − } | |
| 308 | + if (!p->temppath) | |
| 309 | + goto allocfail; | |
| 320 | 310 | // Remove old temp file if it exists. If it exists and we can't remove it, |
| 321 | 311 | // error. |
| 322 | 312 | if (unlink(osoc(p->temppath)) == -1 && errno != ENOENT) { |
| @@ -350,6 +340,8 @@ Conf_save_start_error conf_save_start(Conf_save *p, · 27 unmodified lines | ||
| 350 | 340 | osofree(dir); |
| 351 | 341 | return Conf_save_start_ok; |
| 352 | 342 | |
| 343 | +allocfail: | |
| 344 | + err = Conf_save_start_alloc_failed; | |
| 353 | 345 | cleanup: |
| 354 | 346 | osofree(dir); |
| 355 | 347 | conf_save_cancel(p); |