uci: fix memory leak in rpc_uci_replace_savedir()
[project/rpcd.git] / file.c
diff --git a/file.c b/file.c
index 91a55a1..a09e9de 100644 (file)
--- a/file.c
+++ b/file.c
@@ -2,6 +2,7 @@
  * rpcd - UBUS RPC server
  *
  *   Copyright (C) 2013-2014 Jo-Philipp Wich <jow@openwrt.org>
+ *   Copyright (C) 2016 Luka Perkov <luka@openwrt.org>
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -271,7 +272,7 @@ rpc_file_write(struct ubus_context *ctx, struct ubus_object *obj,
        mode_t prev_mode, mode = 0666;
        int fd, rv = 0;
        void *data = NULL;
-       size_t data_len = 0;
+       ssize_t data_len = 0;
 
        blobmsg_parse(rpc_file_rw_policy, __RPC_F_RW_MAX, tb,
                      blob_data(msg), blob_len(msg));