]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgtop: fix ret pointer usage (#3443)
authorAlessandro Puccetti <alessandro@kinvolk.io>
Mon, 6 Jun 2016 10:38:23 +0000 (12:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 6 Jun 2016 10:38:23 +0000 (12:38 +0200)
src/cgtop/cgtop.c

index b4a982ce38300bc41a02d23f6ba9e217ed66e4d7..6bd22888970245fc96a164a7a91f5a38a576309b 100644 (file)
@@ -868,13 +868,15 @@ static int get_cgroup_root(char **ret) {
         _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
         _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
         _cleanup_free_ char *unit = NULL, *path = NULL;
+        char *aux;
         const char *m;
         int r;
 
         if (arg_root) {
-                *ret = strdup(arg_root);
-                if (!*ret)
+                aux = strdup(arg_root);
+                if (!aux)
                         return log_oom();
+                *ret = aux;
                 return 0;
         }