History

dangling pointer reference (Tim Wiess)

Russ Cox committed 20 years ago

Commit d4753be1 parent 353f9081 file · +5 −5Browse files

Unified · Split

kern/devmnt.c+5−5
@@ -220,9 +220,6 @@ mntversion(Chan *c, char *version, int msize, int returnlen) · 219 unmodified lines
220220 m->msize = f.msize;
221221 unlock(&mntalloc.lk);
222222
223− poperror(); /* msg */
224− free(msg);
225−
226223 lock(&m->lk);
227224 m->queue = 0;
228225 m->rip = 0;
@@ -232,16 +229,19 @@ mntversion(Chan *c, char *version, int msize, int returnlen) · 3 unmodified lines
232229 m->c = c;
233230 unlock(&m->lk);
234231
232+ poperror(); /* msg */
235233 poperror(); /* c */
236234 qunlock(&c->umqlock);
237235
238236 k = strlen(f.version);
239237 if(returnlen > 0){
240− if(returnlen < k)
238+ if(returnlen < k){
239+ free(msg);
241240 error(Eshort);
241+ }
242242 memmove(version, f.version, k);
243243 }
244−
244+ free(msg);
245245 return k;
246246 }
247247

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t