chiark / gitweb /
journal-remote: fix memleak
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Mon, 16 Jun 2014 21:49:10 +0000 (23:49 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Mon, 16 Jun 2014 21:51:34 +0000 (23:51 +0200)
src/journal/journal-remote.c

index 915f234ab2d110394d0646124c54ff0af799578e..31401fb3ee7e6e51d81a1abae3f06316baa3c86e 100644 (file)
@@ -291,7 +291,7 @@ static int remove_source(RemoteServer *s, int fd) {
 
 static int add_source(RemoteServer *s, int fd, const char* name) {
         RemoteSource *source = NULL;
-        char *realname;
+        _cleanup_free_ char *realname = NULL;
         int r;
 
         assert(s);
@@ -307,11 +307,11 @@ static int add_source(RemoteServer *s, int fd, const char* name) {
                         return log_oom();
         }
 
-        log_debug("Creating source for fd:%d (%s)", fd, name);
+        log_debug("Creating source for fd:%d (%s)", fd, realname);
 
         r = get_source_for_fd(s, fd, &source);
         if (r < 0) {
-                log_error("Failed to create source for fd:%d (%s)", fd, name);
+                log_error("Failed to create source for fd:%d (%s)", fd, realname);
                 return r;
         }
         assert(source);