diff mbox

odp_ring_test.c: free buffer on fail

Message ID 1414179993-12296-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit fb47c0d266e6a48e507270f4c18182ce7d9b7646
Headers show

Commit Message

Mike Holmes Oct. 24, 2014, 7:46 p.m. UTC
On data mismatch free the recently mallocked buffer.

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/api_test/odp_ring_test.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mike Holmes Nov. 3, 2014, 6:22 p.m. UTC | #1
ping

On 24 October 2014 15:46, Mike Holmes <mike.holmes@linaro.org> wrote:

> On data mismatch free the recently mallocked buffer.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  test/api_test/odp_ring_test.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c
> index 1da5845..eb1f301 100644
> --- a/test/api_test/odp_ring_test.c
> +++ b/test/api_test/odp_ring_test.c
> @@ -286,6 +286,7 @@ static int consumer_fn(void)
>                 if (i == 0) {
>                         for (i = 0; i < MAX_BULK; i++) {
>                                 if (src[i] != (void *)(unsigned long)i) {
> +                                       free(src);
>                                         printf("data mismatch.. lockless
> ops fail\n");
>                                         return -1;
>                                 }
> --
> 2.1.0
>
>
Santosh Shukla Nov. 4, 2014, 6:57 a.m. UTC | #2
> On 24 October 2014 15:46, Mike Holmes <mike.holmes@linaro.org> wrote:
>
>> On data mismatch free the recently mallocked buffer.
>>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>  test/api_test/odp_ring_test.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c
>> index 1da5845..eb1f301 100644
>> --- a/test/api_test/odp_ring_test.c
>> +++ b/test/api_test/odp_ring_test.c
>> @@ -286,6 +286,7 @@ static int consumer_fn(void)
>>                 if (i == 0) {
>>                         for (i = 0; i < MAX_BULK; i++) {
>>                                 if (src[i] != (void *)(unsigned long)i) {
>> +                                       free(src);
>>                                         printf("data mismatch.. lockless
>> ops fail\n");
>>                                         return -1;
>>                                 }
>>
>
+1,

Reviewed-by: Santosh Shukla <santosh.shukla@linaro.org>

--
>> 2.1.0
>>
>>
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Maxim Uvarov Nov. 5, 2014, 11:45 a.m. UTC | #3
Merged!

Maxim.

On 10/24/2014 11:46 PM, Mike Holmes wrote:
> On data mismatch free the recently mallocked buffer.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   test/api_test/odp_ring_test.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c
> index 1da5845..eb1f301 100644
> --- a/test/api_test/odp_ring_test.c
> +++ b/test/api_test/odp_ring_test.c
> @@ -286,6 +286,7 @@ static int consumer_fn(void)
>   		if (i == 0) {
>   			for (i = 0; i < MAX_BULK; i++) {
>   				if (src[i] != (void *)(unsigned long)i) {
> +					free(src);
>   					printf("data mismatch.. lockless ops fail\n");
>   					return -1;
>   				}
diff mbox

Patch

diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c
index 1da5845..eb1f301 100644
--- a/test/api_test/odp_ring_test.c
+++ b/test/api_test/odp_ring_test.c
@@ -286,6 +286,7 @@  static int consumer_fn(void)
 		if (i == 0) {
 			for (i = 0; i < MAX_BULK; i++) {
 				if (src[i] != (void *)(unsigned long)i) {
+					free(src);
 					printf("data mismatch.. lockless ops fail\n");
 					return -1;
 				}