Message ID | 1357653259-62650-33-git-send-email-hare@suse.de (mailing list archive) |
---|---|
State | Deferred, archived |
Headers | show |
diff --git a/libmultipath/vector.c b/libmultipath/vector.c index 74079a4..dcf69bf 100644 --- a/libmultipath/vector.c +++ b/libmultipath/vector.c @@ -114,7 +114,7 @@ vector_del_slot(vector v, int slot) v->allocated -= VECTOR_DEFAULT_SIZE; - if (!v->allocated) { + if (v->allocated <= 0) { FREE(v->slot); v->slot = NULL; v->allocated = 0; diff --git a/libmultipath/vector.h b/libmultipath/vector.h index 6779186..7612b4c 100644 --- a/libmultipath/vector.h +++ b/libmultipath/vector.h @@ -25,7 +25,7 @@ /* vector definition */ struct _vector { - unsigned int allocated; + int allocated; void **slot; }; typedef struct _vector *vector;
I don't trust the programmers here, as we're unconditionally decreasing the 'allocated' setting on vector_free(). So better make that an integer to catch underflows. Signed-off-by: Hannes Reinecke <hare@suse.de> --- libmultipath/vector.c | 2 +- libmultipath/vector.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)