All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lxc-user-nic: fix the wrong use of realloc
@ 2013-12-13  3:52 Libo Chen
       [not found] ` <52AA8471.9010706-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Libo Chen @ 2013-12-13  3:52 UTC (permalink / raw)
  To: Serge Hallyn, stgraber-GeWIH/nMZzLQT0dZR+AlfA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Li Zefan,
	Huang Qiang

fix the wrong use of realloc

Signed-off-by: Libo Chen <clbchenlibo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 src/lxc/lxc_user_nic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c
index caa411a..ac7a242 100644
--- a/src/lxc/lxc_user_nic.c
+++ b/src/lxc/lxc_user_nic.c
@@ -318,7 +318,7 @@ static bool cull_entries(int fd, char *me, char *t, char *br)
 	p = buf;
 	e = buf + len;
 	while ((p = find_line(p, e, me, t, br)) != NULL) {
-		struct entry_line *newe = realloc(entry_lines, n+1);
+		struct entry_line *newe = realloc(entry_lines, sizeof(*entry_lines)*(n+1));
 		if (!newe) {
 			free(entry_lines);
 			return false;
-- 
1.8.2.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lxc-user-nic: fix the wrong use of realloc
       [not found] ` <52AA8471.9010706-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2013-12-13  4:24   ` Serge Hallyn
  0 siblings, 0 replies; 2+ messages in thread
From: Serge Hallyn @ 2013-12-13  4:24 UTC (permalink / raw)
  To: Libo Chen
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	stgraber-GeWIH/nMZzLQT0dZR+AlfA

Quoting Libo Chen (clbchenlibo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org):
> fix the wrong use of realloc
> 
> Signed-off-by: Libo Chen <clbchenlibo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Embarassing.  Thanks.

Acked-by: Serge E. Hallyn <serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>

> ---
>  src/lxc/lxc_user_nic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c
> index caa411a..ac7a242 100644
> --- a/src/lxc/lxc_user_nic.c
> +++ b/src/lxc/lxc_user_nic.c
> @@ -318,7 +318,7 @@ static bool cull_entries(int fd, char *me, char *t, char *br)
>  	p = buf;
>  	e = buf + len;
>  	while ((p = find_line(p, e, me, t, br)) != NULL) {
> -		struct entry_line *newe = realloc(entry_lines, n+1);
> +		struct entry_line *newe = realloc(entry_lines, sizeof(*entry_lines)*(n+1));
>  		if (!newe) {
>  			free(entry_lines);
>  			return false;
> -- 
> 1.8.2.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-13  4:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13  3:52 [PATCH] lxc-user-nic: fix the wrong use of realloc Libo Chen
     [not found] ` <52AA8471.9010706-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-12-13  4:24   ` Serge Hallyn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.