efl/ethumb: Fix memory leak on error path in ethumb_slave.
authorStefan Schmidt <stefan@datenfreihafen.org>
Mon, 11 Feb 2013 10:54:29 +0000 (10:54 +0000)
committerStefan Schmidt <stefan@datenfreihafen.org>
Mon, 11 Feb 2013 10:54:29 +0000 (10:54 +0000)
When we hit an error with _ec_pipe_str_read we should clean up the strdup
from previous calls to avoid leaks in the error case.

SVN revision: 83817

src/bin/ethumb_client/ethumbd_slave.c

index b1d319a..4a328b8 100644 (file)
@@ -262,13 +262,25 @@ _ec_op_generate(struct _Ethumbd_Child *ec)
      return 0;
    r = _ec_pipe_str_read(ec, &key);
    if (!r)
-     return 0;
+     {
+        free(path);
+        return 0;
+     }
    r = _ec_pipe_str_read(ec, &thumb_path);
    if (!r)
-     return 0;
+     {
+        free(path);
+        free(key);
+        return 0;
+     }
    r = _ec_pipe_str_read(ec, &thumb_key);
    if (!r)
-     return 0;
+     {
+        free(path);
+        free(key);
+        free(thumb_path);
+        return 0;
+     }
 
    ethumb_file_set(ec->ethumbt[idx], path, key);
    ethumb_thumb_path_set(ec->ethumbt[idx], thumb_path, thumb_key);