OLD | NEW |
1 /** | 1 /** |
2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. | 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. |
3 * | 3 * |
4 * See file CREDITS for list of people who contributed to this | 4 * See file CREDITS for list of people who contributed to this |
5 * project. | 5 * project. |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or | 7 * This program is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU General Public License as | 8 * modify it under the terms of the GNU General Public License as |
9 * published by the Free Software Foundation; either version 2 of | 9 * published by the Free Software Foundation; either version 2 of |
10 * the License, or (at your option) any later version. | 10 * the License, or (at your option) any later version. |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "set.h" | 25 #include "set.h" |
26 | 26 |
27 static int | 27 static int |
28 query_alloc(build_image_context *context, | 28 query_alloc(build_image_context *context, |
29 nvbct_lib_id size_id, | 29 nvbct_lib_id size_id, |
30 u_int8_t **dst) | 30 u_int8_t **dst) |
31 { | 31 { |
32 u_int32_t size; | 32 u_int32_t size; |
33 | 33 |
34 /* Note: 3rd argument not used in this particular query. */ | 34 /* Note: 3rd argument not used in this particular query. */ |
35 if (context->bctlib.get_value(size_id, | 35 if (context->bctlib.get_value(size_id, &size, context->bct) != 0) |
36 &size, context->bct) != 0) | |
37 return -ENODATA; | 36 return -ENODATA; |
| 37 |
38 *dst = malloc(size); | 38 *dst = malloc(size); |
39 | 39 |
40 if (*dst == NULL) | 40 if (*dst == NULL) |
41 return -ENOMEM; | 41 return -ENOMEM; |
42 | 42 |
43 memset(*dst, 0, size); | 43 memset(*dst, 0, size); |
44 | 44 |
45 return 0; | 45 return 0; |
46 } | 46 } |
47 | 47 |
(...skipping 26 matching lines...) Expand all Loading... |
74 context_set_value(context, token_redundancy, 1); | 74 context_set_value(context, token_redundancy, 1); |
75 context_set_value(context, token_version, 1); | 75 context_set_value(context, token_version, 1); |
76 | 76 |
77 return 0; | 77 return 0; |
78 | 78 |
79 fail: | 79 fail: |
80 cleanup_context(context); | 80 cleanup_context(context); |
81 | 81 |
82 return e; | 82 return e; |
83 } | 83 } |
OLD | NEW |