Changeset 33b8d024 in mainline for uspace/srv/audio/hound/audio_data.c
- Timestamp:
- 2018-01-16T20:38:46Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2467b41
- Parents:
- d39c46e0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.c
rd39c46e0 r33b8d024 36 36 #include <macros.h> 37 37 #include <stdlib.h> 38 #include <str.h> 38 39 39 40 #include "audio_data.h" … … 50 51 pcm_format_t format) 51 52 { 52 audio_data_t *adata = malloc(sizeof(audio_data_t) );53 audio_data_t *adata = malloc(sizeof(audio_data_t) + size); 53 54 if (adata) { 54 55 unsigned overflow = size % pcm_format_frame_size(&format); … … 56 57 log_warning("Data not a multiple of frame size, " 57 58 "clipping."); 58 59 adata->data = data;59 uint8_t *d = ((uint8_t *)adata) + offsetof(audio_data_t, data); 60 memcpy(d, data, size); 60 61 adata->size = size - overflow; 61 62 adata->format = format; … … 86 87 atomic_count_t refc = atomic_predec(&adata->refcount); 87 88 if (refc == 0) { 88 free(adata->data);89 89 free(adata); 90 90 }
Note:
See TracChangeset
for help on using the changeset viewer.