1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

fileio: get_status_field() don't clobber arg on OOM

According to our coding style guidelines we shouldn't clobber
pass-by-ref arguments on failure, hence don't do so here either.
This commit is contained in:
Lennart Poettering 2015-07-23 23:36:34 +02:00
parent c5f44880ca
commit 901108257e

View File

@ -786,7 +786,7 @@ int executable_is_script(const char *path, char **interpreter) {
*/
int get_status_field(const char *filename, const char *pattern, char **field) {
_cleanup_free_ char *status = NULL;
char *t;
char *t, *f;
size_t len;
int r;
@ -820,9 +820,10 @@ int get_status_field(const char *filename, const char *pattern, char **field) {
len = strcspn(t, WHITESPACE);
*field = strndup(t, len);
if (!*field)
f = strndup(t, len);
if (!f)
return -ENOMEM;
*field = f;
return 0;
}