summaryrefslogtreecommitdiffstats
path: root/plugins/media/media-api.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-24 23:41:10 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-24 23:41:10 +0200
commit50d35140570377d8ee9f0ace78ea825651034829 (patch)
tree34f240ca3c41d39984db9c91457615637b2c7439 /plugins/media/media-api.c
parent2d567b0a2f5251d8808088065085e3173022489f (diff)
Comments and fix of afb_req_unstore
Change-Id: I64e3a1769a225041a998b1b9406a5ebe1a7f19d7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'plugins/media/media-api.c')
-rw-r--r--plugins/media/media-api.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/media/media-api.c b/plugins/media/media-api.c
index 6ba8d1e0..578d0066 100644
--- a/plugins/media/media-api.c
+++ b/plugins/media/media-api.c
@@ -249,6 +249,7 @@ static void on_uploaded(struct afb_req *prequest, int status)
afb_req_fail (request, "failed", "expected file not received");
else
afb_req_success_f (request, NULL, "uploaded file %s", argfile.value);
+ afb_req_unref(request);
}
static void upload (struct afb_req request) { /* AFB_SESSION_CHECK */
@@ -290,8 +291,9 @@ static void upload (struct afb_req request) { /* AFB_SESSION_CHECK */
afb_req_fail (request, "failed", "out of memory");
}
else if (!_rygel_upload (ctx, path, (void*)on_uploaded, prequest)) {
+ afb_req_unref(afb_req_unstore(prequest));
unlink(path);
- afb_req_fail (afb_req_unstore(prequest), "failed", "Error when uploading file to media server... could not complete");
+ afb_req_fail (request, "failed", "Error when uploading file to media server... could not complete");
}
free(path);
}