do not free NULL if pipe allocation fails
This commit is contained in:
parent
05f7605789
commit
9694aad375
@ -616,7 +616,7 @@ netmap_get_pipe_na(struct nmreq *nmr, struct netmap_adapter **na, int create)
|
||||
sna = malloc(sizeof(*mna), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sna == NULL) {
|
||||
error = ENOMEM;
|
||||
goto free_mna;
|
||||
goto unregister_mna;
|
||||
}
|
||||
/* most fields are the same, copy from master and then fix */
|
||||
*sna = *mna;
|
||||
@ -666,6 +666,8 @@ netmap_get_pipe_na(struct nmreq *nmr, struct netmap_adapter **na, int create)
|
||||
|
||||
free_sna:
|
||||
free(sna, M_DEVBUF);
|
||||
unregister_mna:
|
||||
netmap_pipe_remove(pna, mna);
|
||||
free_mna:
|
||||
free(mna, M_DEVBUF);
|
||||
put_out:
|
||||
|
Loading…
Reference in New Issue
Block a user