Commit 4b6ccfdec99e9e3a22566beac76b83d7ff025bff
1 parent
7d510b8c
fixed realloc logic (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1879 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
3 deletions
slirp/mbuf.c
... | ... | @@ -146,18 +146,19 @@ m_inc(m, size) |
146 | 146 | struct mbuf *m; |
147 | 147 | int size; |
148 | 148 | { |
149 | + int datasize; | |
150 | + | |
149 | 151 | /* some compiles throw up on gotos. This one we can fake. */ |
150 | 152 | if(m->m_size>size) return; |
151 | 153 | |
152 | 154 | if (m->m_flags & M_EXT) { |
153 | - /* datasize = m->m_data - m->m_ext; */ | |
155 | + datasize = m->m_data - m->m_ext; | |
154 | 156 | m->m_ext = (char *)realloc(m->m_ext,size); |
155 | 157 | /* if (m->m_ext == NULL) |
156 | 158 | * return (struct mbuf *)NULL; |
157 | 159 | */ |
158 | - /* m->m_data = m->m_ext + datasize; */ | |
160 | + m->m_data = m->m_ext + datasize; | |
159 | 161 | } else { |
160 | - int datasize; | |
161 | 162 | char *dat; |
162 | 163 | datasize = m->m_data - m->m_dat; |
163 | 164 | dat = (char *)malloc(size); | ... | ... |