memcached_string_take_value() takes wrong branch

Bug #1179545 reported by Arjan van Leeuwen
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Committed
Brian Aker

Bug Description

In libmemcached/, in function memcached_string_take_value(), the code says

// If we fail at adding the null, we copy and move on
  if (memcached_success(memcached_string_append_null(self)))
    return memcached_string_c_copy(self);

The code and the comment do not agree with each other. It looks like that should have been memcached_failed. The attached patch fixes this.

Additionally, there is an assert there that I don't understand:

  if (memcached_string_length(self))
    assert_msg(self, "Invalid memcached_string_st");

I don't see why a non-zero length means invalid string, and the rest of the function seems to agree that it is indeed a valid string. Probably a mistake as well, but not changed in the patch since I'm not sure what was meant here.

Revision history for this message
Arjan van Leeuwen (avleeuwen) wrote :
Revision history for this message
Brian Aker (brianaker) wrote :

The assert_msg(self, "Invalid memcached_string_st"); <-- this is a typo

Thanks,... I will see about updating this to a more recent version.

Changed in libmemcached:
assignee: nobody → Brian Aker (brianaker)
milestone: none → 1.0.18
importance: Undecided → Medium
status: New → In Progress
Brian Aker (brianaker)
Changed in libmemcached:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers