Re: [PATCH 3/6] topology: Use generic pointer to realloc buffer for private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dne 28.4.2016 v 10:41 mengdong.lin@xxxxxxxxxxxxxxx napsal(a):
>  	priv_data_size = ref->data->size;
> +	elem->obj = realloc(elem->obj,
> +			elem->size + priv_data_size);
> +	if (!elem->obj)
> +		return -ENOMEM;

This causes a memory leak when realloc fails. You should free the
original pointer when realloc() fails.

					Jaroslav

-- 
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux