summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/core_keymap.c7
-rw-r--r--apps/misc.c6
2 files changed, 7 insertions, 6 deletions
diff --git a/apps/core_keymap.c b/apps/core_keymap.c
index 966f32057a..89e7913c33 100644
--- a/apps/core_keymap.c
+++ b/apps/core_keymap.c
@@ -80,11 +80,12 @@ int core_load_key_remap(const char *filename)
80 int handle = core_alloc(bufsize); 80 int handle = core_alloc(bufsize);
81 if (handle > 0) 81 if (handle > 0)
82 { 82 {
83 core_pin(handle); 83 void *data = core_get_data_pinned(handle);
84 if (read(fd, core_get_data(handle), bufsize) == (ssize_t)bufsize) 84
85 if (read(fd, data, bufsize) == (ssize_t)bufsize)
85 count = action_set_keymap_handle(handle, count); 86 count = action_set_keymap_handle(handle, count);
86 87
87 core_unpin(handle); 88 core_put_data_pinned(data);
88 } 89 }
89 90
90 close(fd); 91 close(fd);
diff --git a/apps/misc.c b/apps/misc.c
index e6c8a219ea..e17df02bff 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1635,8 +1635,7 @@ int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat,
1635 handle = core_alloc_ex(buf_size, ops); 1635 handle = core_alloc_ex(buf_size, ops);
1636 if (handle > 0) 1636 if (handle > 0)
1637 { 1637 {
1638 core_pin(handle); 1638 bm->data = core_get_data_pinned(handle);
1639 bm->data = core_get_data(handle);
1640 lseek(fd, 0, SEEK_SET); /* reset to beginning of file */ 1639 lseek(fd, 0, SEEK_SET); /* reset to beginning of file */
1641 size_read = read_bmp_fd(fd, bm, buf_size, bmformat, NULL); 1640 size_read = read_bmp_fd(fd, bm, buf_size, bmformat, NULL);
1642 1641
@@ -1645,9 +1644,10 @@ int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat,
1645 core_shrink(handle, bm->data, size_read); 1644 core_shrink(handle, bm->data, size_read);
1646 *buf_reqd = size_read; 1645 *buf_reqd = size_read;
1647 } 1646 }
1647
1648 core_put_data_pinned(bm->data);
1648 bm->data = NULL; /* do this to force a crash later if the 1649 bm->data = NULL; /* do this to force a crash later if the
1649 caller doesnt call core_get_data() */ 1650 caller doesnt call core_get_data() */
1650 core_unpin(handle);
1651 } 1651 }
1652 else 1652 else
1653 *buf_reqd = buf_size; /* couldn't allocate pass bytes needed */ 1653 *buf_reqd = buf_size; /* couldn't allocate pass bytes needed */