do not free NULL if pipe allocation fails

This commit is contained in:
Luigi Rizzo 2015-07-19 18:05:49 +00:00
parent 05f7605789
commit 9694aad375

View File

@ -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: